ska-referee-test/ref-test/app/config.py

47 lines
1.3 KiB
Python
Raw Normal View History

import os
from pathlib import Path
if not os.getenv('DATA'):
from dotenv import load_dotenv
load_dotenv('../.env')
class Config(object):
APP_HOST = '0.0.0.0'
2022-06-11 15:16:35 +01:00
DATA = os.getenv('DATA')
DEBUG = False
TESTING = False
SECRET_KEY = os.getenv('SECRET_KEY')
2022-06-16 13:22:06 +01:00
SERVER_NAME = os.getenv('SERVER_NAME')
SESSION_COOKIE_SECURE = True
2022-06-11 15:16:35 +01:00
SQLALCHEMY_DATABASE_URI = f'sqlite:///{Path(DATA)}/database.db'
SQLALCHEMY_TRACK_MODIFICATIONS = False
2022-06-11 11:29:15 +01:00
MAIL_SERVER = os.getenv('MAIL_SERVER')
MAIL_PORT = int(os.getenv('MAIL_PORT'))
MAIL_USE_TLS = False
MAIL_USE_SSL = False
MAIL_DEBUG = False
2022-06-11 11:29:15 +01:00
MAIL_USERNAME = os.getenv('MAIL_USERNAME')
MAIL_PASSWORD = os.getenv('MAIL_PASSWORD')
MAIL_DEFAULT_SENDER = os.getenv('MAIL_DEFAULT_SENDER')
MAIL_MAX_EMAILS = int(os.getenv('MAIL_MAX_EMAILS'))
MAIL_SUPPRESS_SEND = False
2022-06-11 11:29:15 +01:00
MAIL_ASCII_ATTACHMENTS = bool(os.getenv('MAIL_ASCII_ATTACHMENTS'))
class ProductionConfig(Config):
pass
class DevelopmentConfig(Config):
APP_HOST = '127.0.0.1'
DEBUG = True
SESSION_COOKIE_SECURE = False
MAIL_SERVER = 'localhost'
MAIL_DEBUG = True
MAIL_SUPPRESS_SEND = False
class TestingConfig(DevelopmentConfig):
TESTING = True
SESSION_COOKIE_SECURE = False
2022-06-11 11:29:15 +01:00
MAIL_SERVER = os.getenv('MAIL_SERVER')
MAIL_DEBUG = True
MAIL_SUPPRESS_SEND = False