PCv5/config.py

68 lines
2.0 KiB
Python
Raw Normal View History

2018-02-23 23:34:06 +01:00
import os
import datetime
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
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"
# Length allocated to privilege names (slugs)
PRIVS_MAXLEN = 64
# Forbidden user names
FORBIDDEN_USERNAMES = ["admin", "root", "webmaster", "contact"]
2019-02-05 11:30:39 +01:00
# Unauthorized message (@priv_required)
UNAUTHORIZED_MSG = "Vous n'avez pas l'autorisation d'effectuer cette action!"
2019-08-20 17:34:00 +02:00
# Maximum thread name length
THREAD_NAME_MAXLEN = 32
# Amount of comments per thread page
COMMENTS_PER_PAGE = 20
# Remember-me cookie duration time
REMEMBER_COOKIE_DURATION = datetime.timedelta(days=7)
# XP points for content posting (and deletion)
XP_POINTS = {
'topic': 2,
'program': 5,
'tutorial': 5,
'comment': 1,
'contest': 10,
}
# Database name
DB_NAME = "pcv5"
# LDAP usage
USE_LDAP = False
# LDAP configuration
LDAP_PASSWORD = "openldap"
LDAP_ORGANIZATION = "o=planet-casio"
# Secret key used to authenticate tokens. **USE YOURS!**
2020-02-09 23:15:51 +01:00
SECRET_KEY = "a-random-secret-key"
# Avatars folder
AVATARS_FOLDER = '/avatar/folder/'
# 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
class V5Config(LocalConfig, DefaultConfig):
# Values put here cannot be overidden with local_config
pass