Skip to content

Commit

Permalink
Fix configuration handling (#75)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel McKnight <[email protected]>
  • Loading branch information
NeonDaniel and NeonDaniel authored Jan 12, 2024
1 parent 53a058f commit aeab37e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions chat_server/server_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
{})))

Expand Down

0 comments on commit aeab37e

Please sign in to comment.