mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 19:04:18 +00:00
99 lines
4.0 KiB
Python
99 lines
4.0 KiB
Python
from dotenv import load_dotenv
|
|
from pathlib import Path
|
|
import os
|
|
|
|
|
|
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
ENV_FILE = os.path.join(BASE_DIR, 'nopaque.env')
|
|
|
|
|
|
if os.path.isfile(ENV_FILE):
|
|
load_dotenv(ENV_FILE)
|
|
|
|
|
|
class Config:
|
|
''' Configuration class for the Flask application. '''
|
|
|
|
# region APIFairy
|
|
APIFAIRY_TITLE = 'nopaque API'
|
|
APIFAIRY_VERSION = '0.0.1'
|
|
APIFAIRY_APISPEC_PATH = '/api/apispec.json'
|
|
APIFAIRY_UI = 'swagger_ui'
|
|
APIFAIRY_UI_PATH = '/api/docs'
|
|
# endregion APIFairy
|
|
|
|
|
|
# region Flask
|
|
DEBUG = os.environ.get('FLASK_DEBUG', 'false').lower() == 'true'
|
|
PREFERRED_URL_SCHEME = os.environ.get('PREFERRED_URL_SCHEME', 'http')
|
|
SECRET_KEY = os.environ.get('SECRET_KEY', 'hard to guess string')
|
|
SERVER_NAME = os.environ.get('SERVER_NAME', 'localhost:5000')
|
|
SESSION_COOKIE_SECURE = os.environ.get('SESSION_COOKIE_SECURE', 'false').lower() == 'true'
|
|
# endregion Flask
|
|
|
|
|
|
# region Flask-Assets
|
|
ASSETS_DEBUG = os.environ.get('ASSETS_DEBUG', 'false').lower() == 'true'
|
|
# endregion Flask-Assets
|
|
|
|
|
|
# region Flask-Hashids
|
|
HASHIDS_MIN_LENGTH = int(os.environ.get('HASHIDS_MIN_LENGTH', '16'))
|
|
HASHIDS_SALT = os.environ.get('HASHIDS_SALT', 'hard to guess string')
|
|
# endregion Flask-Hashids
|
|
|
|
|
|
# region Flask-Login
|
|
REMEMBER_COOKIE_SECURE = os.environ.get('REMEMBER_COOKIE_SECURE', 'false').lower() == 'true'
|
|
# endregion Flask-Login
|
|
|
|
|
|
# region Flask-Mail
|
|
MAIL_DEFAULT_SENDER = os.environ.get('MAIL_DEFAULT_SENDER')
|
|
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD')
|
|
MAIL_SERVER = os.environ.get('MAIL_SERVER')
|
|
MAIL_PORT = int(os.environ.get('MAIL_PORT'))
|
|
MAIL_USERNAME = os.environ.get('MAIL_USERNAME')
|
|
MAIL_USE_SSL = os.environ.get('MAIL_USE_SSL', 'false').lower() == 'true'
|
|
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS', 'false').lower() == 'true'
|
|
# endregion Flask-Mail
|
|
|
|
|
|
# region Flask-SQLAlchemy
|
|
SQLALCHEMY_DATABASE_URI = os.environ.get('SQLALCHEMY_DATABASE_URI', f'sqlite:///{BASE_DIR}/data.sqlite')
|
|
SQLALCHEMY_RECORD_QUERIES = True
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
# endregion Flask-SQLAlchemy
|
|
|
|
|
|
# region nopaque
|
|
NOPAQUE_ADMIN = os.environ.get('NOPAQUE_ADMIN')
|
|
NOPAQUE_DATA_DIR = Path(os.environ.get('NOPAQUE_DATA_PATH', '/mnt/nopaque'))
|
|
NOPAQUE_IS_PRIMARY_INSTANCE = os.environ.get('NOPAQUE_IS_PRIMARY_INSTANCE', 'true').lower() == 'true'
|
|
NOPAQUE_SERVICE_DESK = 'gitlab-ub-incoming+sfb1288inf-nopaque-1324-issue-@jura.uni-bielefeld.de' # noqa
|
|
NOPAQUE_SOCKETIO_MESSAGE_QUEUE_URI = os.environ.get('NOPAQUE_SOCKETIO_MESSAGE_QUEUE_URI')
|
|
|
|
NOPAQUE_DOCKER_REGISTRY = 'gitlab.ub.uni-bielefeld.de:4567'
|
|
NOPAQUE_DOCKER_IMAGE_PREFIX = f'{NOPAQUE_DOCKER_REGISTRY}/sfb1288inf/'
|
|
NOPAQUE_DOCKER_NETWORK_NAME = os.environ.get('DOCKER_NETWORK_NAME', 'nopaque')
|
|
NOPAQUE_DOCKER_REGISTRY_USERNAME = os.environ.get('NOPAQUE_DOCKER_REGISTRY_USERNAME')
|
|
NOPAQUE_DOCKER_REGISTRY_PASSWORD = os.environ.get('NOPAQUE_DOCKER_REGISTRY_PASSWORD')
|
|
|
|
NOPAQUE_LOG_DATE_FORMAT = os.environ.get('NOPAQUE_LOG_DATE_FORMAT', '%Y-%m-%d %H:%M:%S')
|
|
NOPAQUE_LOG_FORMAT = os.environ.get('NOPAQUE_LOG_FORMAT','[%(asctime)s] %(levelname)s: %(message)s')
|
|
NOPAQUE_LOG_LEVEL = os.environ.get('NOPAQUE_LOG_LEVEL', 'WARNING')
|
|
|
|
NOPAQUE_PROXY_FIX_ENABLED = os.environ.get('NOPAQUE_PROXY_FIX_ENABLED', 'false').lower() == 'true'
|
|
NOPAQUE_PROXY_FIX_X_FOR = int(os.environ.get('NOPAQUE_PROXY_FIX_X_FOR', '0'))
|
|
NOPAQUE_PROXY_FIX_X_HOST = int(os.environ.get('NOPAQUE_PROXY_FIX_X_HOST', '0'))
|
|
NOPAQUE_PROXY_FIX_X_PORT = int(os.environ.get('NOPAQUE_PROXY_FIX_X_PORT', '0'))
|
|
NOPAQUE_PROXY_FIX_X_PREFIX = int(os.environ.get('NOPAQUE_PROXY_FIX_X_PREFIX', '0'))
|
|
NOPAQUE_PROXY_FIX_X_PROTO = int(os.environ.get('NOPAQUE_PROXY_FIX_X_PROTO', '0'))
|
|
|
|
NOPAQUE_TRANSKRIBUS_ENABLED = os.environ.get('NOPAQUE_TRANSKRIBUS_ENABLED', 'false').lower() == 'true'
|
|
NOPAQUE_READCOOP_USERNAME = os.environ.get('NOPAQUE_READCOOP_USERNAME')
|
|
NOPAQUE_READCOOP_PASSWORD = os.environ.get('NOPAQUE_READCOOP_PASSWORD')
|
|
|
|
NOPAQUE_VERSION='1.0.2'
|
|
# endregion nopaque
|