nopaque/config.py

68 lines
2.0 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
<<<<<<< HEAD
# SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir,
# 'data_dev.sqlite')
SQLALCHEMY_DATABASE_URI = \
'postgresql+psycopg2://{user}:{passwd}@{host}:{port}/{db}'.format(
user=os.environ.get('POSTGRES_USER'),
passwd=os.environ.get('POSTGRES_PASSWORD'),
host=os.environ.get('POSTGRES_HOST'),
port=os.environ.get('POSTGRES_PORT'),
db=os.environ.get('POSTGRES_DB_NAME'))
print(SQLALCHEMY_DATABASE_URI)
=======
>>>>>>> e3db2ecd1e52b4993b91e1a1c3501c0fc775de1d
''' ### Flask-SQLAlchemy ### '''
SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(
os.path.join(os.path.dirname(os.path.abspath(__file__)),
'data_dev.sqlite')
)
class ProductionConfig(Config):
''' ### Flask-SQLAlchemy ### '''
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI')
config = {
'development': DevelopmentConfig,
<<<<<<< HEAD
'testing': TestingConfig,
#'production': ProductionConfig,
=======
'production': ProductionConfig,
>>>>>>> e3db2ecd1e52b4993b91e1a1c3501c0fc775de1d
'default': DevelopmentConfig
}