Further merge fixes
This commit is contained in:
parent
045614c6c8
commit
70270b09be
1 changed files with 1 additions and 29 deletions
30
app.py
30
app.py
|
@ -33,47 +33,19 @@ from util.config.provider import FileConfigProvider, TestConfigProvider
|
||||||
from util.config.configutil import generate_secret_key
|
from util.config.configutil import generate_secret_key
|
||||||
from util.config.superusermanager import SuperUserManager
|
from util.config.superusermanager import SuperUserManager
|
||||||
|
|
||||||
# pylint: disable=invalid-name,too-many-public-methods,too-few-public-methods,too-many-ancestors
|
|
||||||
class Config(BaseConfig):
|
|
||||||
""" Flask config enhanced with a `from_yamlfile` method """
|
|
||||||
|
|
||||||
def from_yamlfile(self, config_file):
|
|
||||||
with open(config_file) as f:
|
|
||||||
c = yaml.load(f)
|
|
||||||
if not c:
|
|
||||||
logger.debug('Empty YAML config file')
|
|
||||||
return
|
|
||||||
|
|
||||||
if isinstance(c, str):
|
|
||||||
raise Exception('Invalid YAML config file: ' + str(c))
|
|
||||||
|
|
||||||
for key in c.iterkeys():
|
|
||||||
if key.isupper():
|
|
||||||
self[key] = c[key]
|
|
||||||
|
|
||||||
class Flask(BaseFlask):
|
|
||||||
""" Extends the Flask class to implement our custom Config class. """
|
|
||||||
|
|
||||||
def make_config(self, instance_relative=False):
|
|
||||||
root_path = self.instance_path if instance_relative else self.root_path
|
|
||||||
return Config(root_path, self.default_config)
|
|
||||||
|
|
||||||
|
|
||||||
OVERRIDE_CONFIG_DIRECTORY = 'conf/stack/'
|
OVERRIDE_CONFIG_DIRECTORY = 'conf/stack/'
|
||||||
OVERRIDE_CONFIG_YAML_FILENAME = 'conf/stack/config.yaml'
|
OVERRIDE_CONFIG_YAML_FILENAME = 'conf/stack/config.yaml'
|
||||||
OVERRIDE_CONFIG_PY_FILENAME = 'conf/stack/config.py'
|
OVERRIDE_CONFIG_PY_FILENAME = 'conf/stack/config.py'
|
||||||
|
|
||||||
OVERRIDE_CONFIG_KEY = 'QUAY_OVERRIDE_CONFIG'
|
OVERRIDE_CONFIG_KEY = 'QUAY_OVERRIDE_CONFIG'
|
||||||
LICENSE_FILENAME = 'conf/stack/license.enc'
|
LICENSE_FILENAME = 'conf/stack/license.enc'
|
||||||
>>>>>>> master
|
|
||||||
|
|
||||||
|
CONFIG_PROVIDER = FileConfigProvider(OVERRIDE_CONFIG_DIRECTORY, 'config.yaml', 'config.py')
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
profile = logging.getLogger('profile')
|
profile = logging.getLogger('profile')
|
||||||
|
|
||||||
CONFIG_PROVIDER = FileConfigProvider('conf/stack/', 'config.yaml', 'config.py')
|
|
||||||
|
|
||||||
# Instantiate the default configuration (for test or for normal operation).
|
# Instantiate the default configuration (for test or for normal operation).
|
||||||
if 'TEST' in os.environ:
|
if 'TEST' in os.environ:
|
||||||
CONFIG_PROVIDER = TestConfigProvider()
|
CONFIG_PROVIDER = TestConfigProvider()
|
||||||
|
|
Reference in a new issue