PCv5/config.py

63 lines
1.8 KiB
Python
Raw Permalink Normal View History

2018-02-23 23:34:06 +01:00
import os
2021-02-21 20:17:48 +01:00
from datetime import timedelta
try:
from local_config import LocalConfig
except ImportError:
print(" \033[92mWARNING: Local config not found\033[0m")
2020-02-09 23:10:02 +01:00
class LocalConfig():
pass
class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY') or LocalConfig.SECRET_KEY
2018-02-23 23:34:06 +01:00
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or \
'postgresql+psycopg2://' + os.environ.get('USER') + ':@/' \
+ LocalConfig.DB_NAME
2018-02-23 23:34:06 +01:00
SQLALCHEMY_TRACK_MODIFICATIONS = False
2020-07-21 21:06:00 +02:00
MAIL_DEFAULT_SENDER = "noreply@v5.planet-casio.com"
MAIL_SUPPRESS_SEND = None
# Only send cookies over HTTPS connections (use only if HTTPS is enabled)
SESSION_COOKIE_SECURE = True
# Only send cookies in requests, do not expose them to Javascript
SESSION_COOKIE_HTTPONLY = True
# Do not attach cookies to cross-origin requests
SESSION_COOKIE_SAMESITE = "Lax"
class DefaultConfig(object):
"""Every value here can be overrided in the local_config.py class"""
2020-07-21 21:06:00 +02:00
# Domain
DOMAIN = "v5.planet-casio.com"
# Database name
DB_NAME = "pcv5"
# LDAP usage
USE_LDAP = False
# LDAP configuration
LDAP_PASSWORD = "openldap"
2020-08-25 23:05:54 +02:00
LDAP_ROOT = "o=planet-casio"
LDAP_ENV = "o=prod"
# Secret key used to authenticate tokens. **USE YOURS!**
2020-02-09 23:15:51 +01:00
SECRET_KEY = "a-random-secret-key"
# Uploaded data folder
DATA_FOLDER = '/var/www/uploads'
# Enable guest post
ENABLE_GUEST_POST = True
2020-07-21 21:06:00 +02:00
# Disable email confimation
ENABLE_EMAIL_CONFIRMATION = True
# Send emails
SEND_MAILS = True
# GLaDOS configuration
GLADOS_HOST = "127.0.0.1"
GLADOS_PORT = 5555
2021-02-21 20:17:48 +01:00
# Time before trigerring the necropost alert
NECROPOST_LIMIT = timedelta(days=31)
class V5Config(LocalConfig, DefaultConfig):
# Values put here cannot be overidden with local_config
pass