ai-dev-template / cpp /include /core /config.hpp
Jordandevlog's picture
Upload cpp/include/core/config.hpp
d6bb3fc verified
Raw
History Blame Contribute Delete
681 Bytes
/**
* @file config.hpp
* @brief Application configuration using modern C++23 features.
*/
#pragma once
#include <string>
#include <optional>
#include <expected>
#include <format>
namespace app::core {
/**
* @brief Runtime configuration loaded from environment or defaults.
*/
struct Config {
std::string app_name{"MyApp"};
std::string database_url{"sqlite:///app.db"};
std::string secret_key{"change-me"};
int port{8080};
bool debug{false};
/**
* @brief Load configuration from environment variables.
* @return Config object or error string.
*/
static std::expected<Config, std::string> from_env();
};
} // namespace app::core