|
|
@@ -108,7 +108,7 @@ auto ConfigLoader::GetDefaultConfigPaths() -> std::vector<std::string> {
|
|
|
|
|
|
auto ConfigLoader::FindConfigFile() -> std::optional<std::string> {
|
|
|
// Check environment variable for explicit config path
|
|
|
- const char* config_path_env = std::getenv("SMARTBOTIC_SERVER_CONFIG");
|
|
|
+ const char* config_path_env = std::getenv("SMARTBOTIC_CRM_SERVER_CONFIG");
|
|
|
if (config_path_env != nullptr && std::filesystem::exists(config_path_env)) {
|
|
|
return std::string(config_path_env);
|
|
|
}
|
|
|
@@ -218,6 +218,14 @@ auto ConfigLoader::LoadFromFile(const std::string& path) -> std::optional<HttpSe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // LLM section
|
|
|
+ if (json.contains("llm")) {
|
|
|
+ const auto& llm = json["llm"];
|
|
|
+ if (llm.contains("address")) {
|
|
|
+ config.llm_address = llm["address"].get<std::string>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// JWT section
|
|
|
if (json.contains("jwt")) {
|
|
|
const auto& jwt = json["jwt"];
|
|
|
@@ -249,22 +257,25 @@ auto ConfigLoader::LoadFromFile(const std::string& path) -> std::optional<HttpSe
|
|
|
|
|
|
void ConfigLoader::ApplyEnvironment(HttpServerConfig& config) {
|
|
|
// Server settings from environment
|
|
|
- config.address = GetEnvOrDefault("SMARTBOTIC_SERVER_ADDRESS", config.address);
|
|
|
- config.port = GetEnvOrDefault("SMARTBOTIC_SERVER_PORT", config.port);
|
|
|
- config.webui_path = GetEnvOrDefault("SMARTBOTIC_SERVER_WEBUI_PATH", config.webui_path);
|
|
|
- config.ws_path = GetEnvOrDefault("SMARTBOTIC_SERVER_WS_PATH", config.ws_path);
|
|
|
+ config.address = GetEnvOrDefault("SMARTBOTIC_CRM_SERVER_ADDRESS", config.address);
|
|
|
+ config.port = GetEnvOrDefault("SMARTBOTIC_CRM_SERVER_PORT", config.port);
|
|
|
+ config.webui_path = GetEnvOrDefault("SMARTBOTIC_CRM_SERVER_WEBUI_PATH", config.webui_path);
|
|
|
+ config.ws_path = GetEnvOrDefault("SMARTBOTIC_CRM_SERVER_WS_PATH", config.ws_path);
|
|
|
|
|
|
// CORS settings from environment
|
|
|
- config.cors.enabled = GetEnvBool("SMARTBOTIC_SERVER_CORS_ENABLED", config.cors.enabled);
|
|
|
+ config.cors.enabled = GetEnvBool("SMARTBOTIC_CRM_SERVER_CORS_ENABLED", config.cors.enabled);
|
|
|
|
|
|
// Database settings from environment
|
|
|
- config.database_address = GetEnvOrDefault("SMARTBOTIC_SERVER_DATABASE_ADDRESS", config.database_address);
|
|
|
+ config.database_address = GetEnvOrDefault("SMARTBOTIC_CRM_SERVER_DATABASE_ADDRESS", config.database_address);
|
|
|
+
|
|
|
+ // LLM settings from environment
|
|
|
+ config.llm_address = GetEnvOrDefault("SMARTBOTIC_CRM_SERVER_LLM_ADDRESS", config.llm_address);
|
|
|
|
|
|
// JWT settings from environment (secret from env is recommended for security)
|
|
|
- config.jwt.secret = GetEnvOrDefault("SMARTBOTIC_SERVER_JWT_SECRET", config.jwt.secret);
|
|
|
+ config.jwt.secret = GetEnvOrDefault("SMARTBOTIC_CRM_SERVER_JWT_SECRET", config.jwt.secret);
|
|
|
|
|
|
// Log level from environment
|
|
|
- const char* log_level_env = std::getenv("SMARTBOTIC_SERVER_LOG_LEVEL");
|
|
|
+ const char* log_level_env = std::getenv("SMARTBOTIC_CRM_SERVER_LOG_LEVEL");
|
|
|
if (log_level_env != nullptr) {
|
|
|
auto level = ParseLogLevel(log_level_env);
|
|
|
if (level) {
|
|
|
@@ -451,13 +462,13 @@ void ConfigLoader::PrintHelp(const char* program_name) {
|
|
|
spdlog::info(" --no-cors Disable CORS headers");
|
|
|
spdlog::info("");
|
|
|
spdlog::info("Environment Variables:");
|
|
|
- spdlog::info(" SMARTBOTIC_SERVER_CONFIG Path to config file");
|
|
|
- spdlog::info(" SMARTBOTIC_SERVER_ADDRESS Address to bind to");
|
|
|
- spdlog::info(" SMARTBOTIC_SERVER_PORT Port to listen on");
|
|
|
- spdlog::info(" SMARTBOTIC_SERVER_WEBUI_PATH Path to WebUI static files");
|
|
|
- spdlog::info(" SMARTBOTIC_SERVER_DATABASE_ADDRESS Database gRPC address");
|
|
|
- spdlog::info(" SMARTBOTIC_SERVER_LOG_LEVEL Log level");
|
|
|
- spdlog::info(" SMARTBOTIC_SERVER_CORS_ENABLED Enable/disable CORS (true/false)");
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_SERVER_CONFIG Path to config file");
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_SERVER_ADDRESS Address to bind to");
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_SERVER_PORT Port to listen on");
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_SERVER_WEBUI_PATH Path to WebUI static files");
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_SERVER_DATABASE_ADDRESS Database gRPC address");
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_SERVER_LOG_LEVEL Log level");
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_SERVER_CORS_ENABLED Enable/disable CORS (true/false)");
|
|
|
spdlog::info("");
|
|
|
spdlog::info("Config File Search Order:");
|
|
|
for (const auto& path : GetDefaultConfigPaths()) {
|