Skip to content

Commit

Permalink
fix: don't overwrite env vars from config if set
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Oct 4, 2023
1 parent 4434f92 commit b1cafb9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions horde_worker_regen/bridge_data/data_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class reGenBridgeData(CombinedHordeBridgeData):

def load_env_vars(self) -> None:
"""Load the environment variables into the config model."""
if self.models_folder_parent:
if self.models_folder_parent and os.getenv("AIWORKER_CACHE_HOME") is None:
os.environ["AIWORKER_CACHE_HOME"] = self.models_folder_parent
if self.horde_url:
if os.environ.get("AI_HORDE_URL"):
Expand All @@ -35,10 +35,15 @@ def load_env_vars(self) -> None:
"AI_HORDE_DEV_URL environment variable already set. This will override the value for "
"`horde_url` in the config file.",
)
else:
if os.environ.get("AI_HORDE_URL") is None:
os.environ["AI_HORDE_URL"] = self.horde_url
else:
logger.warning(
"AI_HORDE_URL environment variable already set. This will override the value for `horde_url` "
"in the config file.",
)

if self.max_lora_cache_size:
if self.max_lora_cache_size and os.getenv("AIWORKER_LORA_CACHE_SIZE") is None:
os.environ["AIWORKER_LORA_CACHE_SIZE"] = str(self.max_lora_cache_size * 1024)

def save(self, file_path: str) -> None:
Expand Down

0 comments on commit b1cafb9

Please sign in to comment.