mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-07 19:05:39 +00:00
Adjustment in application config
This commit is contained in:
parent
454dce2d71
commit
53b4fe2f8b
@ -5,7 +5,10 @@ import requests
|
|||||||
import urlparse
|
import urlparse
|
||||||
from app import app
|
from app import app
|
||||||
|
|
||||||
TIMEOUT = app.config['TIMEOUT']
|
if 'TIMEOUT' in app.config.keys():
|
||||||
|
TIMEOUT = app.config['TIMEOUT']
|
||||||
|
else:
|
||||||
|
TIMEOUT = 10
|
||||||
|
|
||||||
def auth_from_url(url):
|
def auth_from_url(url):
|
||||||
auth = None
|
auth = None
|
||||||
|
@ -14,11 +14,14 @@ from lib import utils
|
|||||||
from lib.log import logger
|
from lib.log import logger
|
||||||
logging = logger('MODEL', app.config['LOG_LEVEL'], app.config['LOG_FILE']).config()
|
logging = logger('MODEL', app.config['LOG_LEVEL'], app.config['LOG_FILE']).config()
|
||||||
|
|
||||||
LDAP_URI = app.config['LDAP_URI']
|
if 'LDAP_TYPE' in app.config.keys():
|
||||||
LDAP_USERNAME = app.config['LDAP_USERNAME']
|
LDAP_URI = app.config['LDAP_URI']
|
||||||
LDAP_PASSWORD = app.config['LDAP_PASSWORD']
|
LDAP_USERNAME = app.config['LDAP_USERNAME']
|
||||||
LDAP_SEARCH_BASE = app.config['LDAP_SEARCH_BASE']
|
LDAP_PASSWORD = app.config['LDAP_PASSWORD']
|
||||||
LDAP_TYPE = app.config['LDAP_TYPE']
|
LDAP_SEARCH_BASE = app.config['LDAP_SEARCH_BASE']
|
||||||
|
LDAP_TYPE = app.config['LDAP_TYPE']
|
||||||
|
else:
|
||||||
|
LDAP_TYPE = False
|
||||||
|
|
||||||
PDNS_STATS_URL = app.config['PDNS_STATS_URL']
|
PDNS_STATS_URL = app.config['PDNS_STATS_URL']
|
||||||
PDNS_API_KEY = app.config['PDNS_API_KEY']
|
PDNS_API_KEY = app.config['PDNS_API_KEY']
|
||||||
@ -147,6 +150,10 @@ class User(db.Model):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
elif method == 'LDAP':
|
elif method == 'LDAP':
|
||||||
|
if not LDAP_TYPE:
|
||||||
|
logging.error('LDAP authentication is disabled')
|
||||||
|
return False
|
||||||
|
|
||||||
if LDAP_TYPE == 'ldap':
|
if LDAP_TYPE == 'ldap':
|
||||||
searchFilter = "cn=%s" % self.username
|
searchFilter = "cn=%s" % self.username
|
||||||
else:
|
else:
|
||||||
|
@ -4,6 +4,7 @@ basedir = os.path.abspath(os.path.dirname(__file__))
|
|||||||
# BASIC APP CONFIG
|
# BASIC APP CONFIG
|
||||||
WTF_CSRF_ENABLED = True
|
WTF_CSRF_ENABLED = True
|
||||||
SECRET_KEY = 'We are the world'
|
SECRET_KEY = 'We are the world'
|
||||||
|
BIND_ADDRESS = '127.0.0.1'
|
||||||
PORT = 9393
|
PORT = 9393
|
||||||
|
|
||||||
# TIMEOUT - for large zones
|
# TIMEOUT - for large zones
|
||||||
@ -22,11 +23,11 @@ SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
|
|||||||
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
SQLALCHEMY_TRACK_MODIFICATIONS = True
|
||||||
|
|
||||||
# LDAP CONFIG
|
# LDAP CONFIG
|
||||||
|
LDAP_TYPE = 'ldap' # use 'ad' for MS Active Directory
|
||||||
LDAP_URI = 'ldaps://your-ldap-server:636'
|
LDAP_URI = 'ldaps://your-ldap-server:636'
|
||||||
LDAP_USERNAME = 'cn=dnsuser,ou=users,ou=services,dc=duykhanh,dc=me'
|
LDAP_USERNAME = 'cn=dnsuser,ou=users,ou=services,dc=duykhanh,dc=me'
|
||||||
LDAP_PASSWORD = 'dnsuser'
|
LDAP_PASSWORD = 'dnsuser'
|
||||||
LDAP_SEARCH_BASE = 'ou=System Admins,ou=People,dc=duykhanh,dc=me'
|
LDAP_SEARCH_BASE = 'ou=System Admins,ou=People,dc=duykhanh,dc=me'
|
||||||
LDAP_TYPE = 'ldap' // or 'ad'
|
|
||||||
|
|
||||||
# POWERDNS CONFIG
|
# POWERDNS CONFIG
|
||||||
PDNS_STATS_URL = 'http://172.16.214.131:8081/'
|
PDNS_STATS_URL = 'http://172.16.214.131:8081/'
|
||||||
|
7
run.py
7
run.py
@ -2,5 +2,10 @@
|
|||||||
from app import app
|
from app import app
|
||||||
from config import PORT
|
from config import PORT
|
||||||
|
|
||||||
|
try:
|
||||||
|
from config import BIND_ADDRESS
|
||||||
|
except:
|
||||||
|
BIND_ADDRESS = '127.0.0.1'
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug = True, port=PORT)
|
app.run(debug = True, host=BIND_ADDRESS, port=PORT)
|
||||||
|
Loading…
Reference in New Issue
Block a user