Finish the configuration bits

master
kaiyou 6 years ago
parent 82069ea3f0
commit 206cce0b47

@ -20,8 +20,9 @@ def create_app_from_config(config):
utils.limiter.init_app(app) utils.limiter.init_app(app)
utils.babel.init_app(app) utils.babel.init_app(app)
utils.login.init_app(app) utils.login.init_app(app)
utils.login.user_loader(models.User.query.get) utils.login.user_loader(models.User.get)
utils.proxy.init_app(app) utils.proxy.init_app(app)
utils.migrate.init_app(app, models.db)
# Initialize debugging tools # Initialize debugging tools
if app.config.get("DEBUG"): if app.config.get("DEBUG"):

@ -4,7 +4,7 @@ import os
DEFAULT_CONFIG = { DEFAULT_CONFIG = {
# Specific to the admin UI # Specific to the admin UI
'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/main.db', 'SQLALCHEMY_DATABASE_URI': 'sqlite:////data/main.db',
'SQLALCHEMY_TRACK_MODIFICATIONS': True, 'SQLALCHEMY_TRACK_MODIFICATIONS': False,
'DOCKER_SOCKET': 'unix:///var/run/docker.sock', 'DOCKER_SOCKET': 'unix:///var/run/docker.sock',
'BABEL_DEFAULT_LOCALE': 'en', 'BABEL_DEFAULT_LOCALE': 'en',
'BABEL_DEFAULT_TIMEZONE': 'UTC', 'BABEL_DEFAULT_TIMEZONE': 'UTC',
@ -54,7 +54,7 @@ DEFAULT_CONFIG = {
} }
class ConfigManager(object): class ConfigManager(dict):
""" Naive configuration manager that uses environment only """ Naive configuration manager that uses environment only
""" """
@ -77,6 +77,9 @@ class ConfigManager(object):
def get(self, *args): def get(self, *args):
return self.config.get(*args) return self.config.get(*args)
def keys(self):
return self.config.keys()
def __getitem__(self, key): def __getitem__(self, key):
return self.config.get(key) return self.config.get(key)

Loading…
Cancel
Save