mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
66 lines
1.7 KiB
Python
66 lines
1.7 KiB
Python
import os
|
|
|
|
|
|
class Config:
|
|
''' ### Flask ### '''
|
|
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
|
|
|
|
''' ### Flask-Mail ### '''
|
|
MAIL_SERVER = os.environ.get('MAIL_SERVER')
|
|
MAIL_PORT = int(os.environ.get('MAIL_PORT'))
|
|
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS').lower() == 'true'
|
|
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
|
|
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
|
|
MAIL_DEFAULT_SENDER = os.environ.get('MAIL_DEFAULT_SENDER')
|
|
|
|
''' ### Flask-SQLAlchemy ### '''
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
|
|
''' ### Opaque ### '''
|
|
OPAQUE_ADMIN = os.environ.get('OPAQUE_ADMIN')
|
|
OPAQUE_STORAGE_DIRECTORY = '/opaque_storage'
|
|
|
|
@staticmethod
|
|
def init_app(app):
|
|
pass
|
|
|
|
|
|
class DevelopmentConfig(Config):
|
|
''' ### Flask ### '''
|
|
DEBUG = True
|
|
|
|
''' ### Flask-SQLAlchemy ### '''
|
|
SQLALCHEMY_DATABASE_URI = 'postgresql://{}:{}@db/{}'.format(
|
|
os.environ.get('POSTGRES_USER'),
|
|
os.environ.get('POSTGRES_PASSWORD'),
|
|
os.environ.get('POSTGRES_DB_NAME')
|
|
)
|
|
|
|
|
|
class TestingConfig(Config):
|
|
''' ### Flask ### '''
|
|
TESTING = True
|
|
|
|
''' ### Flask-SQLAlchemy ### '''
|
|
SQLALCHEMY_DATABASE_URI = 'sqlite://'
|
|
|
|
''' ### Flask-WTF ### '''
|
|
WTF_CSRF_ENABLED = False
|
|
|
|
|
|
class ProductionConfig(Config):
|
|
''' ### Flask-SQLAlchemy ### '''
|
|
SQLALCHEMY_DATABASE_URI = 'postgresql://{}:{}@db/{}'.format(
|
|
os.environ.get('POSTGRES_USER'),
|
|
os.environ.get('POSTGRES_PASSWORD'),
|
|
os.environ.get('POSTGRES_DB_NAME')
|
|
)
|
|
|
|
|
|
config = {
|
|
'development': DevelopmentConfig,
|
|
'testing': TestingConfig,
|
|
'production': ProductionConfig,
|
|
'default': DevelopmentConfig
|
|
}
|