Skip to content

Commit

Permalink
Set default hknweb_mode to dev
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-ni committed Sep 16, 2023
1 parent feaf673 commit 8982275
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
4 changes: 2 additions & 2 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ def deploy_github_actions(c, target=None):
c.run(f"bash ./scripts/run_github_actions.sh {c.current_path}")


hknweb_mode = os.environ["HKNWEB_MODE"].lower()
hknweb_mode = os.getenv("HKNWEB_MODE", "dev").lower()
if hknweb_mode == "dev":
config_file = ConfigFiles.GITHUB_ACTIONS
deploy = deploy_github_actions
elif hknweb_mode == "prod":
config_file = ConfigFiles.PROD
else:
raise ValueError(f"HKNWEB_MODE '{hknweb_mode}' is not a valid value")
raise ValueError(f"HKNWEB_MODE {hknweb_mode!r} is not a valid value")

config_dict = json.load(open(config_file))
config = DeployConfig(overrides=config_dict)
Expand Down
22 changes: 9 additions & 13 deletions hknweb/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import os
import sys

try:
HKNWEB_MODE = os.environ["HKNWEB_MODE"].lower()
if HKNWEB_MODE == "dev":
from .dev import * # lgtm [py/polluting-import]
elif HKNWEB_MODE == "prod":
from .prod import * # lgtm [py/polluting-import]
else:
print("HKNWEB_MODE is not a valid value")
sys.exit()
except KeyError:
print(
"SETTINGS says: HKNWEB_MODE not supplied, so no data will be loaded into settings. You can still load of the subpackages manually."
)
HKNWEB_MODE = os.getenv("HKNWEB_MODE", "dev").lower()

if HKNWEB_MODE == "dev":
from .dev import * # lgtm [py/polluting-import]
elif HKNWEB_MODE == "prod":
from .prod import * # lgtm [py/polluting-import]
else:
print(f"HKNWEB_MODE {HKNWEB_MODE!r} is not a valid value")
sys.exit()

0 comments on commit 8982275

Please sign in to comment.