2023-07-27 21:22:12 -07: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 02:26:44 -07:00
|
|
|
SERVER_NAME = os.environ.get('SERVER_NAME') or 'localhost'
|
|
|
|
SECRET_KEY = os.environ.get('SECRET_KEY') or 'you-will-never-guesss'
|
2023-07-27 21:22:12 -07:00
|
|
|
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
|
|
|
|
'sqlite:///' + os.path.join(basedir, 'app.db')
|
|
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
2024-02-29 19:43:05 -08:00
|
|
|
MAIL_SERVER = os.environ.get('MAIL_SERVER') or None
|
2023-07-27 21:22:12 -07:00
|
|
|
MAIL_PORT = int(os.environ.get('MAIL_PORT') or 25)
|
|
|
|
MAIL_USE_TLS = os.environ.get('MAIL_USE_TLS') is not None
|
2024-02-29 19:43:05 -08:00
|
|
|
MAIL_USERNAME = os.environ.get('MAIL_USERNAME') or None
|
|
|
|
MAIL_PASSWORD = os.environ.get('MAIL_PASSWORD') or None
|
2024-06-26 02:24:07 -07:00
|
|
|
MAIL_FROM = os.environ.get('MAIL_FROM') or 'noreply@' + os.environ.get('SERVER_NAME')
|
2024-02-29 19:43:05 -08:00
|
|
|
MAIL_ERRORS = os.environ.get('MAIL_ERRORS') is not None
|
2024-02-25 01:11:25 -08:00
|
|
|
ADMINS = os.environ.get('ADMINS')
|
2024-03-30 15:42:34 -07: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-25 20:41:11 -07:00
|
|
|
MODE = os.environ.get('MODE') or 'development'
|
2024-08-22 17:28:10 -07:00
|
|
|
LANGUAGES = ['ca', 'de', 'en', 'fr', 'ja']
|
2024-03-08 22:24:56 -08:00
|
|
|
FULL_AP_CONTEXT = bool(int(os.environ.get('FULL_AP_CONTEXT', 0)))
|
2023-09-16 00:09:04 -07:00
|
|
|
CACHE_TYPE = os.environ.get('CACHE_TYPE') or 'FileSystemCache'
|
2024-01-02 19:29:58 -08:00
|
|
|
CACHE_REDIS_URL = os.environ.get('CACHE_REDIS_URL') or 'redis://localhost:6379/1'
|
2023-09-16 00:09:04 -07: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-23 16:28:41 -08: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-29 10:12:17 -08:00
|
|
|
SQLALCHEMY_ECHO = False # set to true to see SQL in console
|
2024-01-27 21:11:32 -08:00
|
|
|
WTF_CSRF_TIME_LIMIT = None # a value of None ensures csrf token is valid for the lifetime of the session
|
|
|
|
|
2024-06-26 05:47:24 -07:00
|
|
|
BOUNCE_ADDRESS = os.environ.get('BOUNCE_ADDRESS') or MAIL_FROM or '' # Warning: all emails in this inbox will be deleted!
|
2024-02-26 10:09:56 -08: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-23 17:33:41 -08:00
|
|
|
|
2024-06-30 08:06:18 -07:00
|
|
|
BOOTSTRAP_SERVE_LOCAL = True
|
|
|
|
|
2024-02-28 08:25:10 -08:00
|
|
|
SENTRY_DSN = os.environ.get('SENTRY_DSN') or None
|
2024-02-29 19:43:05 -08:00
|
|
|
|
|
|
|
AWS_REGION = os.environ.get('AWS_REGION') or None
|
2024-03-20 15:07:11 -07:00
|
|
|
|
|
|
|
SESSION_COOKIE_SECURE = True
|
|
|
|
SESSION_COOKIE_HTTPONLY = True
|
|
|
|
SESSION_COOKIE_SAMESITE = 'Lax'
|
2024-03-22 10:52:55 -07:00
|
|
|
|
|
|
|
CLOUDFLARE_API_TOKEN = os.environ.get('CLOUDFLARE_API_TOKEN') or ''
|
|
|
|
CLOUDFLARE_ZONE_ID = os.environ.get('CLOUDFLARE_ZONE_ID') or ''
|
2024-04-14 17:08:04 -07:00
|
|
|
|
2024-04-16 02:56:55 -07:00
|
|
|
SPICY_UNDER_10 = float(os.environ.get('SPICY_UNDER_10', 1.0))
|
|
|
|
SPICY_UNDER_30 = float(os.environ.get('SPICY_UNDER_30', 1.0))
|
|
|
|
SPICY_UNDER_60 = float(os.environ.get('SPICY_UNDER_60', 1.0))
|
2024-08-01 01:24:36 -07:00
|
|
|
|
|
|
|
IPINFO_TOKEN = os.environ.get('IPINFO_TOKEN') or ''
|
2025-01-19 16:47:10 -08:00
|
|
|
|
|
|
|
DB_POOL_SIZE = os.environ.get('DB_POOL_SIZE') or 10
|
|
|
|
DB_MAX_OVERFLOW = os.environ.get('DB_MAX_OVERFLOW') or 30
|