Modification de la gestion de configuration
Cf https://gitea.planet-casio.com/devs/PCv5/wiki/Configuration-locale
This commit is contained in:
parent
e8ffbd598e
commit
74862634df
24
config.py
24
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
|
||||
|
|
Loading…
Reference in New Issue