Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration Handling fix #75

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading