Dynamically enable modules based on config values
This commit is contained in:
parent
4063754e12
commit
04b5e04593
3 changed files with 75 additions and 68 deletions
|
@ -83,37 +83,37 @@ DB_URI = 'sqlite:////tmp/wiki.db'
|
|||
# DB_URI = 'oracle://scott:tiger@127.0.0.1:1521/sidname'
|
||||
# DB_URI = 'crate://'
|
||||
|
||||
LDAP = {
|
||||
'URI': '',
|
||||
# LDAP = {
|
||||
# 'URI': '',
|
||||
#
|
||||
# # This BIND_DN/BIND_PASSWORD default to '', this is shown here for demonstrative purposes
|
||||
# # The values '' perform an anonymous bind so we may use search/bind method
|
||||
# 'BIND_DN': '',
|
||||
# 'BIND_AUTH': '',
|
||||
#
|
||||
# # Adding the USER_SEARCH field tells the flask-ldap-login that we are using
|
||||
# # the search/bind method
|
||||
# 'USER_SEARCH': {'base': 'dc=example,dc=com', 'filter': 'uid=%(username)s'},
|
||||
#
|
||||
# # Map ldap keys into application specific keys
|
||||
# 'KEY_MAP': {
|
||||
# 'name': 'cn',
|
||||
# 'company': 'o',
|
||||
# 'location': 'l',
|
||||
# 'email': 'mail',
|
||||
# }
|
||||
# }
|
||||
|
||||
# This BIND_DN/BIND_PASSWORD default to '', this is shown here for demonstrative purposes
|
||||
# The values '' perform an anonymous bind so we may use search/bind method
|
||||
'BIND_DN': '',
|
||||
'BIND_AUTH': '',
|
||||
|
||||
# Adding the USER_SEARCH field tells the flask-ldap-login that we are using
|
||||
# the search/bind method
|
||||
'USER_SEARCH': {'base': 'dc=example,dc=com', 'filter': 'uid=%(username)s'},
|
||||
|
||||
# Map ldap keys into application specific keys
|
||||
'KEY_MAP': {
|
||||
'name': 'cn',
|
||||
'company': 'o',
|
||||
'location': 'l',
|
||||
'email': 'mail',
|
||||
}
|
||||
}
|
||||
|
||||
OAUTH = {
|
||||
'twitter': {
|
||||
'key': '',
|
||||
'secret': ''
|
||||
},
|
||||
'github': {
|
||||
'key': '',
|
||||
'secret': ''
|
||||
}
|
||||
}
|
||||
# OAUTH = {
|
||||
# 'twitter': {
|
||||
# 'key': '',
|
||||
# 'secret': ''
|
||||
# },
|
||||
# 'github': {
|
||||
# 'key': '',
|
||||
# 'secret': ''
|
||||
# }
|
||||
# }
|
||||
|
||||
CACHE_TYPE = 'simple'
|
||||
|
||||
|
@ -153,6 +153,7 @@ WIKI_PATH = '/tmp/wiki'
|
|||
# Name of page that will act as home
|
||||
WIKI_HOME = 'home'
|
||||
|
||||
AUTH_LOCAL_ENABLE = True
|
||||
ALLOW_ANON = True
|
||||
REGISTRATION_ENABLED = True
|
||||
PRIVATE_WIKI = False
|
||||
|
@ -193,4 +194,13 @@ if ENV != "DEV":
|
|||
ASSETS_DEBUG = False
|
||||
SQLALCHEMY_ECHO = False
|
||||
|
||||
MODULES = ['wiki', 'search', 'auth', 'auth.local', 'auth.oauth', 'auth.ldap', 'auth.oauth']
|
||||
MODULES = ['wiki', 'search', 'auth']
|
||||
|
||||
if globals().get('AUTH_LOCAL_ENABLE'):
|
||||
MODULES.append('auth.local')
|
||||
|
||||
if globals().get('OAUTH'):
|
||||
MODULES.append('auth.oauth')
|
||||
|
||||
if globals().get('LDAP'):
|
||||
MODULES.append('auth.ldap')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue