nopaque/config.py

48 lines
1.2 KiB
Python
Raw Normal View History

2019-07-03 08:31:23 +00:00
import os
basedir = os.path.abspath(os.path.dirname(__file__))
2019-07-03 08:31:23 +00:00
class Config:
2019-08-26 07:57:26 +00:00
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'
2019-07-08 09:29:11 +00:00
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
OPAQUE_ADMIN = os.environ.get('OPAQUE_ADMIN')
2019-08-05 06:36:11 +00:00
OPAQUE_STORAGE = os.environ.get('OPAQUE_STORAGE')
2019-07-08 09:29:11 +00:00
OPAQUE_MAIL_SUBJECT_PREFIX = '[Opaque]'
2019-08-26 07:57:26 +00:00
OPAQUE_MAIL_SENDER = 'Opaque'
2019-07-03 08:31:23 +00:00
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_TRACK_MODIFICATIONS = False
2019-07-03 13:40:09 +00:00
@staticmethod
def init_app(app):
pass
class DevelopmentConfig(Config):
DEBUG = True
2019-08-22 07:35:23 +00:00
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir,
'data_dev.sqlite')
2019-07-03 13:40:09 +00:00
2019-07-08 08:52:36 +00:00
class TestingConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = os.environ.get('TEST_DATABASE_URL') or \
'sqlite://'
WTF_CSRF_ENABLED = False
2019-07-03 13:40:09 +00:00
# class ProductionConfig(Config):
config = {
'development': DevelopmentConfig,
2019-07-08 08:52:36 +00:00
'testing': TestingConfig,
2019-07-03 13:40:09 +00:00
# 'production': ProductionConfig,
'default': DevelopmentConfig
}