Move config provider to _init to decouple from app
remove app references from validators
This commit is contained in:
parent
86929c16d3
commit
d45b925155
26 changed files with 54 additions and 51 deletions
12
app.py
12
app.py
|
@ -13,7 +13,9 @@ from flask_principal import Principal
|
|||
from jwkest.jwk import RSAKey
|
||||
|
||||
import features
|
||||
from _init import CONF_DIR
|
||||
|
||||
from _init import config_provider, CONF_DIR, IS_KUBERNETES, IS_TESTING, OVERRIDE_CONFIG_DIRECTORY
|
||||
|
||||
from auth.auth_context import get_authenticated_user
|
||||
from avatars.avatars import Avatar
|
||||
from buildman.manager.buildcanceller import BuildCanceller
|
||||
|
@ -41,7 +43,6 @@ from util.saas.useranalytics import UserAnalytics
|
|||
from util.saas.exceptionlog import Sentry
|
||||
from util.names import urn_generator
|
||||
from util.config.configutil import generate_secret_key
|
||||
from util.config.provider import get_config_provider
|
||||
from util.config.superusermanager import SuperUserManager
|
||||
from util.label_validator import LabelValidator
|
||||
from util.metrics.metricqueue import MetricQueue
|
||||
|
@ -53,7 +54,6 @@ from util.security.instancekeys import InstanceKeys
|
|||
from util.security.signing import Signer
|
||||
|
||||
|
||||
OVERRIDE_CONFIG_DIRECTORY = os.path.join(CONF_DIR, 'stack/')
|
||||
OVERRIDE_CONFIG_YAML_FILENAME = os.path.join(CONF_DIR, 'stack/config.yaml')
|
||||
OVERRIDE_CONFIG_PY_FILENAME = os.path.join(CONF_DIR, 'stack/config.py')
|
||||
|
||||
|
@ -65,10 +65,8 @@ app = Flask(__name__)
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Instantiate the configuration.
|
||||
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.py',
|
||||
testing=is_testing, kubernetes=is_kubernetes)
|
||||
is_testing = IS_TESTING
|
||||
is_kubernetes = IS_KUBERNETES
|
||||
|
||||
if is_testing:
|
||||
from test.testconfig import TestConfig
|
||||
|
|
Reference in a new issue