mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 23:20:27 +00:00
Env oauth url (#1030)
Overriding settings in DB using environment variable in docker
This commit is contained in:
parent
c7b4aa3434
commit
3081036c2c
@ -5,6 +5,9 @@ SQLALCHEMY_DATABASE_URI = 'sqlite:////data/powerdns-admin.db'
|
|||||||
|
|
||||||
legal_envvars = (
|
legal_envvars = (
|
||||||
'SECRET_KEY',
|
'SECRET_KEY',
|
||||||
|
'OIDC_OAUTH_API_URL',
|
||||||
|
'OIDC_OAUTH_TOKEN_URL',
|
||||||
|
'OIDC_OAUTH_AUTHORIZE_URL',
|
||||||
'BIND_ADDRESS',
|
'BIND_ADDRESS',
|
||||||
'PORT',
|
'PORT',
|
||||||
'LOG_LEVEL',
|
'LOG_LEVEL',
|
||||||
|
@ -268,11 +268,18 @@ class Setting(db.Model):
|
|||||||
|
|
||||||
def get(self, setting):
|
def get(self, setting):
|
||||||
if setting in self.defaults:
|
if setting in self.defaults:
|
||||||
|
|
||||||
|
if setting.upper() in current_app.config:
|
||||||
|
result = current_app.config[setting.upper()]
|
||||||
|
else:
|
||||||
result = self.query.filter(Setting.name == setting).first()
|
result = self.query.filter(Setting.name == setting).first()
|
||||||
|
|
||||||
if result is not None:
|
if result is not None:
|
||||||
return strtobool(result.value) if result.value in [
|
if hasattr(result,'value'):
|
||||||
|
result = result.value
|
||||||
|
return strtobool(result) if result in [
|
||||||
'True', 'False'
|
'True', 'False'
|
||||||
] else result.value
|
] else result
|
||||||
else:
|
else:
|
||||||
return self.defaults[setting]
|
return self.defaults[setting]
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user