Blame view

config/old_config/__init__.py 756 Bytes
1192cc3d   Etienne Pallier   Nouveau système d...
1
2
3
4
5
6
7
# Inspired from https://whalesalad.com/blog/doing-python-configuration-right

import os
import importlib

# Determine the environment we want to load, default is development.py
PYROS_ENV = os.environ.get("PYROS_ENV", "config_dev")
2d3d3ee8   Etienne Pallier   clean log message...
8
PYROS_DEBUG = os.environ.get("PYROS_DEBUG", '0') == '1'
1192cc3d   Etienne Pallier   Nouveau système d...
9
10
11

module = importlib.import_module(
    #f".environments.{ENV}", package="service.config"
a9d06e6f   Etienne Pallier   new PYROS_DOCKER_...
12
13
    #f".{PYROS_ENV}", package="config"
    f".{PYROS_ENV}", package="config.old_config"
1192cc3d   Etienne Pallier   Nouveau système d...
14
15
16
17
18
19
20
21
22
)

# update globals of this module (i.e. settings) with imported.
globals().update(vars(module))


def is_dev_env(): return PYROS_ENV == "config_dev"
def is_test_env(): return PYROS_ENV == "config_test"
def is_prod_env(): return PYROS_ENV == "config_prod"
2d3d3ee8   Etienne Pallier   clean log message...
23
def is_debug(): return PYROS_DEBUG
1192cc3d   Etienne Pallier   Nouveau système d...