From 1ce32182bd953db4e49aa7d321f17ddb27db9ff3 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 20 Dec 2023 15:44:32 -0800 Subject: [PATCH] Fix configuration handling --- chat_server/server_config.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/chat_server/server_config.py b/chat_server/server_config.py index ca03e2c0..b852c969 100644 --- a/chat_server/server_config.py +++ b/chat_server/server_config.py @@ -70,20 +70,22 @@ def _init_db_controller(db_config: dict) -> Optional[DatabaseController]: LOG.warning(f"Using legacy configuration at {server_config_path}") LOG.warning(f"Using legacy configuration at {database_config_path}") LOG.info(f"KLAT_ENV : {Configuration.KLAT_ENV}") - config = Configuration(from_files=[server_config_path, database_config_path]) + config = Configuration(from_files=[server_config_path, + database_config_path]) app_config = config.get("CHAT_SERVER", {}).get(Configuration.KLAT_ENV, {}) db_controller = config.get_db_controller(name="pyklatchat_3333") else: # ovos-config has built-in mechanisms for loading configuration files based # on envvars, so the configuration structure is simplified from ovos_config.config import Configuration - app_config = Configuration().get("CHAT_SERVER") or dict() + config = Configuration() + app_config = config.get("CHAT_SERVER") or dict() env_spec = os.environ.get("KLAT_ENV") if env_spec and app_config.get(env_spec): LOG.warning("Legacy configuration handling KLAT_ENV envvar") app_config = app_config.get(env_spec) db_controller = _init_db_controller(app_config.get("connection_properties", - Configuration().get( + config.get( "DATABASE_CONFIG", {})))