prevent pc config override (#1130)

This commit is contained in:
Sheldon 2023-06-05 08:22:26 +08:00 committed by GitHub
parent 9b4462370b
commit 62785fc358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -218,12 +218,13 @@ class Config(Base):
continue continue
os.environ[key] = str(value) os.environ[key] = str(value)
# Load env variables from env file # Avoid overriding if env_path is not provided or does not exist
load_dotenv(self.env_path, override=self.override_os_envs) # type: ignore if self.env_path is not None and os.path.isfile(self.env_path):
# Recompute constants after loading env variables load_dotenv(self.env_path, override=self.override_os_envs) # type: ignore
importlib.reload(constants) # Recompute constants after loading env variables
# Recompute instance attributes importlib.reload(constants)
self.recompute_field_values() # Recompute instance attributes
self.recompute_field_values()
def recompute_field_values(self): def recompute_field_values(self):
"""Recompute instance field values to reflect new values after reloading """Recompute instance field values to reflect new values after reloading

View File

@ -100,7 +100,7 @@ DEPLOY_URL = get_value("DEPLOY_URL")
# bun root location # bun root location
BUN_ROOT_PATH = "$HOME/.bun" BUN_ROOT_PATH = "$HOME/.bun"
# The default path where bun is installed. # The default path where bun is installed.
BUN_PATH = f"{BUN_ROOT_PATH}/bin/bun" BUN_PATH = get_value("BUN_PATH", f"{BUN_ROOT_PATH}/bin/bun")
# Command to install bun. # Command to install bun.
INSTALL_BUN = f"curl -fsSL https://bun.sh/install | bash -s -- bun-v{MAX_BUN_VERSION}" INSTALL_BUN = f"curl -fsSL https://bun.sh/install | bash -s -- bun-v{MAX_BUN_VERSION}"
# Default host in dev mode. # Default host in dev mode.