diff --git a/src/pai_rag/core/rag_configuration.py b/src/pai_rag/core/rag_configuration.py index b9de7f49..4f916d21 100644 --- a/src/pai_rag/core/rag_configuration.py +++ b/src/pai_rag/core/rag_configuration.py @@ -30,12 +30,14 @@ def from_snapshot(cls): @classmethod def from_file(cls, config_file): try: - settings_files = [config_file, GENERATED_CONFIG_FILE_NAME] + settings_files = [config_file] config = Dynaconf( envvar_prefix="PAIRAG", settings_file=settings_files, merge=True, ) + snapshot_config = Dynaconf(settings_file=[GENERATED_CONFIG_FILE_NAME]) + config.update(snapshot_config, tomlfy=True, merge=True) return cls(config) # `envvar_prefix` = export envvars with `export PAIRAG_FOO=bar`. # `settings_files` = Load these files in the order. @@ -54,8 +56,6 @@ def update(self, new_value: Dynaconf): def persist(self): """Save configuration to file.""" data = self.config.as_dict() - data["dynaconf_merge"] = True - os.makedirs("localdata", exist_ok=True) loaders.write(GENERATED_CONFIG_FILE_NAME, DynaBox(data).to_dict(), merge=True)