Change import paths to be absolute, change pythonpath for config app
This commit is contained in:
parent
c378e408ef
commit
841053f878
19 changed files with 814 additions and 79 deletions
31
config_app/c_app.py
Normal file
31
config_app/c_app.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
import os
|
||||
import logging
|
||||
from flask import Flask
|
||||
from _init_config import CONF_DIR
|
||||
from config_app.config_util.config import get_config_provider
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
OVERRIDE_CONFIG_DIRECTORY = os.path.join(CONF_DIR, 'stack/')
|
||||
|
||||
|
||||
is_testing = 'TEST' in os.environ
|
||||
is_kubernetes = 'KUBERNETES_SERVICE_HOST' in os.environ
|
||||
|
||||
config_provider = get_config_provider(OVERRIDE_CONFIG_DIRECTORY, 'config.yaml', 'config_app_config.py',
|
||||
testing=is_testing, kubernetes=is_kubernetes)
|
||||
|
||||
if is_testing:
|
||||
from config_app.config_test.testconfig import TestConfig
|
||||
logger.debug('Loading test config.')
|
||||
app.config.from_object(TestConfig())
|
||||
else:
|
||||
from config_app.config_app_config import DefaultConfig
|
||||
logger.debug('Loading default config.')
|
||||
app.config.from_object(DefaultConfig())
|
||||
# app.teardown_request(database.close_db_filter)
|
||||
|
||||
# Load the override config via the provider.
|
||||
config_provider.update_app_config(app.config)
|
Reference in a new issue