|
@@ -104,7 +104,7 @@ auto ConfigLoader::GetDefaultConfigPaths() -> std::vector<std::string> {
|
|
|
|
|
|
|
|
auto ConfigLoader::FindConfigFile() -> std::optional<std::string> {
|
|
auto ConfigLoader::FindConfigFile() -> std::optional<std::string> {
|
|
|
// Check environment variable for explicit config path
|
|
// Check environment variable for explicit config path
|
|
|
- const char* config_path_env = std::getenv("SMARTBOTIC_DB_CONFIG");
|
|
|
|
|
|
|
+ const char* config_path_env = std::getenv("SMARTBOTIC_CRM_DB_CONFIG");
|
|
|
if (config_path_env != nullptr && std::filesystem::exists(config_path_env)) {
|
|
if (config_path_env != nullptr && std::filesystem::exists(config_path_env)) {
|
|
|
return std::string(config_path_env);
|
|
return std::string(config_path_env);
|
|
|
}
|
|
}
|
|
@@ -204,16 +204,16 @@ auto ConfigLoader::LoadFromFile(const std::string& path) -> std::optional<Databa
|
|
|
|
|
|
|
|
void ConfigLoader::ApplyEnvironment(DatabaseConfig& config) {
|
|
void ConfigLoader::ApplyEnvironment(DatabaseConfig& config) {
|
|
|
// Server settings from environment (can override config file)
|
|
// Server settings from environment (can override config file)
|
|
|
- config.address = GetEnvOrDefault("SMARTBOTIC_DB_ADDRESS", config.address);
|
|
|
|
|
- config.port = GetEnvOrDefault("SMARTBOTIC_DB_PORT", config.port);
|
|
|
|
|
- config.data_dir = GetEnvOrDefault("SMARTBOTIC_DB_DATA_DIR", config.data_dir);
|
|
|
|
|
|
|
+ config.address = GetEnvOrDefault("SMARTBOTIC_CRM_DB_ADDRESS", config.address);
|
|
|
|
|
+ config.port = GetEnvOrDefault("SMARTBOTIC_CRM_DB_PORT", config.port);
|
|
|
|
|
+ config.data_dir = GetEnvOrDefault("SMARTBOTIC_CRM_DB_DATA_DIR", config.data_dir);
|
|
|
|
|
|
|
|
// Snapshot settings from environment
|
|
// Snapshot settings from environment
|
|
|
config.snapshot_interval_seconds =
|
|
config.snapshot_interval_seconds =
|
|
|
- GetEnvOrDefault("SMARTBOTIC_DB_SNAPSHOT_INTERVAL", config.snapshot_interval_seconds);
|
|
|
|
|
|
|
+ GetEnvOrDefault("SMARTBOTIC_CRM_DB_SNAPSHOT_INTERVAL", config.snapshot_interval_seconds);
|
|
|
|
|
|
|
|
// Log level from environment
|
|
// Log level from environment
|
|
|
- const char* log_level_env = std::getenv("SMARTBOTIC_DB_LOG_LEVEL");
|
|
|
|
|
|
|
+ const char* log_level_env = std::getenv("SMARTBOTIC_CRM_DB_LOG_LEVEL");
|
|
|
if (log_level_env != nullptr) {
|
|
if (log_level_env != nullptr) {
|
|
|
auto level = ParseLogLevel(log_level_env);
|
|
auto level = ParseLogLevel(log_level_env);
|
|
|
if (level) {
|
|
if (level) {
|
|
@@ -222,7 +222,7 @@ void ConfigLoader::ApplyEnvironment(DatabaseConfig& config) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Encryption key path from environment (for secrets)
|
|
// Encryption key path from environment (for secrets)
|
|
|
- const char* key_path_env = std::getenv("SMARTBOTIC_DB_ENCRYPTION_KEY_PATH");
|
|
|
|
|
|
|
+ const char* key_path_env = std::getenv("SMARTBOTIC_CRM_DB_ENCRYPTION_KEY_PATH");
|
|
|
if (key_path_env != nullptr) {
|
|
if (key_path_env != nullptr) {
|
|
|
config.encryption_key_path = key_path_env;
|
|
config.encryption_key_path = key_path_env;
|
|
|
}
|
|
}
|
|
@@ -420,14 +420,14 @@ void ConfigLoader::PrintHelp(const char* program_name) {
|
|
|
spdlog::info(" --encryption-key-path <p> Path to encryption key file");
|
|
spdlog::info(" --encryption-key-path <p> Path to encryption key file");
|
|
|
spdlog::info("");
|
|
spdlog::info("");
|
|
|
spdlog::info("Environment Variables:");
|
|
spdlog::info("Environment Variables:");
|
|
|
- spdlog::info(" SMARTBOTIC_DB_CONFIG Path to config file");
|
|
|
|
|
- spdlog::info(" SMARTBOTIC_DB_ADDRESS Address to bind to");
|
|
|
|
|
- spdlog::info(" SMARTBOTIC_DB_PORT Port to listen on");
|
|
|
|
|
- spdlog::info(" SMARTBOTIC_DB_DATA_DIR Data directory");
|
|
|
|
|
- spdlog::info(" SMARTBOTIC_DB_SNAPSHOT_INTERVAL Snapshot interval in seconds");
|
|
|
|
|
- spdlog::info(" SMARTBOTIC_DB_LOG_LEVEL Log level");
|
|
|
|
|
- spdlog::info(" SMARTBOTIC_DB_ENCRYPTION_KEY_PATH Path to encryption key file");
|
|
|
|
|
- spdlog::info(" SMARTBOTIC_DB_ENCRYPTION_KEY Encryption key (base64 encoded) - for secrets");
|
|
|
|
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_DB_CONFIG Path to config file");
|
|
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_DB_ADDRESS Address to bind to");
|
|
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_DB_PORT Port to listen on");
|
|
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_DB_DATA_DIR Data directory");
|
|
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_DB_SNAPSHOT_INTERVAL Snapshot interval in seconds");
|
|
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_DB_LOG_LEVEL Log level");
|
|
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_DB_ENCRYPTION_KEY_PATH Path to encryption key file");
|
|
|
|
|
+ spdlog::info(" SMARTBOTIC_CRM_DB_ENCRYPTION_KEY Encryption key (base64 encoded) - for secrets");
|
|
|
spdlog::info("");
|
|
spdlog::info("");
|
|
|
spdlog::info("Config File Search Order:");
|
|
spdlog::info("Config File Search Order:");
|
|
|
for (const auto& path : GetDefaultConfigPaths()) {
|
|
for (const auto& path : GetDefaultConfigPaths()) {
|
|
@@ -446,7 +446,7 @@ void ConfigLoader::PrintConfig(const DatabaseConfig& config) {
|
|
|
if (!config.encryption_key_path.empty()) {
|
|
if (!config.encryption_key_path.empty()) {
|
|
|
spdlog::info(" Encryption Key: {} (path configured)", config.encryption_key_path);
|
|
spdlog::info(" Encryption Key: {} (path configured)", config.encryption_key_path);
|
|
|
} else {
|
|
} else {
|
|
|
- const char* key_env = std::getenv("SMARTBOTIC_DB_ENCRYPTION_KEY");
|
|
|
|
|
|
|
+ const char* key_env = std::getenv("SMARTBOTIC_CRM_DB_ENCRYPTION_KEY");
|
|
|
if (key_env != nullptr) {
|
|
if (key_env != nullptr) {
|
|
|
spdlog::info(" Encryption Key: (from environment variable)");
|
|
spdlog::info(" Encryption Key: (from environment variable)");
|
|
|
} else {
|
|
} else {
|