File tree Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Expand file tree Collapse file tree 2 files changed +16
-15
lines changed Original file line number Diff line number Diff line change
1
+ export ENV ?= stage
1
2
VENV_NAME ?= venv
2
3
PIP ?= pip
3
4
PYTHON ?= python3.11
4
- ENV ?= stage
5
5
6
6
venv : $(VENV_NAME ) /bin/activate
7
7
@@ -13,19 +13,7 @@ $(VENV_NAME)/bin/activate: pyproject.toml
13
13
test : venv
14
14
$(VENV_NAME ) /bin/python -m unittest discover tests
15
15
16
- build : set-config venv
16
+ build : venv
17
17
cp LICENSE LICENSE.bak
18
18
$(VENV_NAME ) /bin/python -m build
19
19
rm LICENSE.bak
20
-
21
- set-config :
22
- ifeq ($(ENV ) , stage)
23
- @cp extend/config/config_stage.py extend/config/config.py
24
- @echo "Using STAGING configuration"
25
- else ifeq ($(ENV), prod)
26
- @cp extend/config/config_prod.py extend/config/config.py
27
- @echo "Using PRODUCTION configuration"
28
- else
29
- @echo "Invalid ENV value. Use 'stage' or 'prod'."
30
- @exit 1
31
- endif
Original file line number Diff line number Diff line change 1
- from .config import API_HOST , API_VERSION
1
+ import os
2
+
3
+ from dotenv import load_dotenv
4
+
5
+ load_dotenv ()
6
+
7
+ env = os .getenv ("ENV" , "dev" )
8
+
9
+ if env == "stage" :
10
+ from .config_stage import API_HOST , API_VERSION
11
+ elif env == "prod" :
12
+ from .config_prod import API_HOST , API_VERSION
13
+ else :
14
+ from .config_stage import API_HOST , API_VERSION
2
15
3
16
__all__ = [
4
17
"API_HOST" ,
You can’t perform that action at this time.
0 commit comments