2023-07-28 16:22:12 +12:00
|
|
|
import os
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
basedir = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
load_dotenv(os.path.join(basedir, '.env'))
|
|
|
|
|
|
|
|
|
|
|
|
class Config(object):
|
2023-08-05 21:26:44 +12:00
|
|
|
SERVER_NAME = os.environ.get('SERVER_NAME') or 'localhost'
|
|
|
|
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guesss'
|
2023-07-28 16:22:12 +12:00
|
|
|
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
|
|
|
|
'sqlite:///' + os.path.join(basedir, 'app.db')
|
|
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
2024-03-01 16:43:05 +13:00
|
|
|
MAIL_SERVER = os.environ.get('MAIL_SERVER') or None
|
2023-07-28 16:22:12 +12:00
|
|
|
MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25)
|
|
|
|
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
|
2024-03-01 16:43:05 +13:00
|
|
|
MAIL_USERNAME = os.environ.get('MAIL_USERNAME') or None
|
|
|
|
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD') or None
|
|
|
|
MAIL_FROM = os.environ.get('MAIL_FROM') or None
|
|
|
|
MAIL_ERRORS = os.environ.get('MAIL_ERRORS') is not None
|
2024-02-25 10:11:25 +01:00
|
|
|
ADMINS = os.environ.get('ADMINS')
|
2024-03-31 11:42:34 +13:00
|
|
|
RECAPTCHA_PUBLIC_KEY = os.environ.get("RECAPTCHA_PUBLIC_KEY") or None
|
|
|
|
RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY") or None
|
2023-08-26 15:41:11 +12:00
|
|
|
MODE = os.environ.get('MODE') or 'development'
|
2024-03-17 20:33:29 +13:00
|
|
|
LANGUAGES = ['de', 'en']
|
2024-03-09 19:24:56 +13:00
|
|
|
FULL_AP_CONTEXT = bool(int(os.environ.get('FULL_AP_CONTEXT', 0)))
|
2023-09-16 19:09:04 +12:00
|
|
|
CACHE_TYPE = os.environ.get('CACHE_TYPE') or 'FileSystemCache'
|
2024-01-03 16:29:58 +13:00
|
|
|
CACHE_REDIS_URL = os.environ.get('CACHE_REDIS_URL') or 'redis://localhost:6379/1'
|
2023-09-16 19:09:04 +12:00
|
|
|
CACHE_DIR = os.environ.get('CACHE_DIR') or '/dev/shm/pyfedi'
|
|
|
|
CACHE_DEFAULT_TIMEOUT = 300
|
|
|
|
CACHE_THRESHOLD = 1000
|
|
|
|
CACHE_KEY_PREFIX = 'pyfedi'
|
2023-12-24 13:28:41 +13:00
|
|
|
CELERY_BROKER_URL = os.environ.get('CELERY_BROKER_URL') or 'redis://localhost:6379/0'
|
|
|
|
RESULT_BACKEND = os.environ.get('RESULT_BACKEND') or 'redis://localhost:6379/0'
|
2023-11-30 07:12:17 +13:00
|
|
|
SQLALCHEMY_ECHO = False # set to true to see SQL in console
|
2024-01-28 18:11:32 +13:00
|
|
|
WTF_CSRF_TIME_LIMIT = None # a value of None ensures csrf token is valid for the lifetime of the session
|
|
|
|
|
2024-02-27 07:09:56 +13:00
|
|
|
BOUNCE_HOST = os.environ.get('BOUNCE_HOST') or ''
|
|
|
|
BOUNCE_USERNAME = os.environ.get('BOUNCE_USERNAME') or ''
|
|
|
|
BOUNCE_PASSWORD = os.environ.get('BOUNCE_PASSWORD') or ''
|
2024-02-24 14:33:41 +13:00
|
|
|
|
2024-02-28 17:25:10 +01:00
|
|
|
SENTRY_DSN = os.environ.get('SENTRY_DSN') or None
|
2024-03-01 16:43:05 +13:00
|
|
|
|
|
|
|
AWS_REGION = os.environ.get('AWS_REGION') or None
|
2024-03-21 11:07:11 +13:00
|
|
|
|
|
|
|
SESSION_COOKIE_SECURE = True
|
|
|
|
SESSION_COOKIE_HTTPONLY = True
|
|
|
|
SESSION_COOKIE_SAMESITE = 'Lax'
|
2024-03-23 06:52:55 +13:00
|
|
|
|
|
|
|
CLOUDFLARE_API_TOKEN = os.environ.get('CLOUDFLARE_API_TOKEN') or ''
|
|
|
|
CLOUDFLARE_ZONE_ID = os.environ.get('CLOUDFLARE_ZONE_ID') or ''
|
2024-04-15 12:08:04 +12:00
|
|
|
|
2024-04-15 12:18:36 +12:00
|
|
|
SPICY_UNDER_10 = float(os.environ.get('SPICY_UNDER_10')) or 1.0
|
|
|
|
SPICY_UNDER_30 = float(os.environ.get('SPICY_UNDER_30')) or 1.0
|
|
|
|
SPICY_UNDER_60 = float(os.environ.get('SPICY_UNDER_60')) or 1.0
|