Modification de la gestion de configuration

Cf https://gitea.planet-casio.com/devs/PCv5/wiki/Configuration-locale
This commit is contained in:
Darks 2020-02-09 23:04:00 +01:00
parent e8ffbd598e
commit 74862634df
Signed by untrusted user: Darks
GPG Key ID: F61F10FA138E797C
1 changed files with 22 additions and 2 deletions

View File

@ -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