From 74862634dfd82022cf6fd8cac38f0784efc32647 Mon Sep 17 00:00:00 2001 From: Darks Date: Sun, 9 Feb 2020 23:04:00 +0100 Subject: [PATCH] Modification de la gestion de configuration Cf https://gitea.planet-casio.com/devs/PCv5/wiki/Configuration-locale --- config.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index f1de2ae..e5545b4 100644 --- a/config.py +++ b/config.py @@ -1,6 +1,11 @@ import os import datetime -from local_config import LocalConfig + +try: + from local_config import LocalConfig +except ImportError: + print(" \033[92mWARNING: Local config not found\033[0m") + class Config(object): SECRET_KEY = os.environ.get('SECRET_KEY') or LocalConfig.SECRET_KEY @@ -10,7 +15,7 @@ class Config(object): SQLALCHEMY_TRACK_MODIFICATIONS = False -class V5Config(LocalConfig): +class DefaultConfig(object): # Length allocated to privilege names (slugs) PRIVS_MAXLEN = 64 # Forbidden user names @@ -36,3 +41,18 @@ class V5Config(LocalConfig): '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!** + SECRET_KEY = "some-secret-key" + # Avatars folder + AVATARS_FOLDER = '/avatar/folder/' + +class V5Config(LocalConfig, DefaultConfig): + # Args put here cannot be overidden with local_config + pass