Add an application config for local mode but hosted data.

This commit is contained in:
yackob03 2013-10-01 17:23:29 -04:00
parent 540815b943
commit fb91fb98da
2 changed files with 18 additions and 4 deletions

14
app.py
View file

@ -5,13 +5,19 @@ from flask import Flask
from flask.ext.principal import Principal
from flask.ext.login import LoginManager
from flask.ext.mail import Mail
from config import ProductionConfig, DebugConfig
from config import ProductionConfig, DebugConfig, LocalHostedConfig
app = Flask(__name__)
is_prod = os.environ.get('STACK', '').strip().lower().startswith('prod')
config_object = ProductionConfig() if is_prod else DebugConfig()
app.config.from_object(config_object)
stack = os.environ.get('STACK', '').strip().lower()
if stack.startswith('prod'):
config = ProductionConfig()
elif stack.startswith('localhosted'):
config = LocalHostedConfig()
else:
config = DebugConfig()
app.config.from_object(config)
logger = logging.getLogger(__name__)

View file

@ -62,6 +62,14 @@ class DebugConfig(FlaskConfig, MailConfig, LocalStorage, SQLiteDB):
}
class LocalHostedConfig(FlaskConfig, MailConfig, S3Storage, RDSMySQL):
REGISTRY_SERVER = 'localhost:5000'
LOGGING_CONFIG = {
'level': logging.DEBUG,
'format': LOG_FORMAT
}
class ProductionConfig(FlaskConfig, MailConfig, S3Storage, RDSMySQL):
REGISTRY_SERVER = 'quay.io'
LOGGING_CONFIG = {