Skip to content

Commit

Permalink
Fix configuration conflict (#143)
Browse files Browse the repository at this point in the history
* Fix merge bug

* Fix version conflict for config file

* Resolve snapshot merge conflict
  • Loading branch information
moria97 authored Aug 5, 2024
1 parent b6d5b4e commit 5ad9579
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pai_rag/core/rag_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)

Expand Down

0 comments on commit 5ad9579

Please sign in to comment.