mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-04-15 08:28:21 +00:00
Fix docker bool config value
This commit is contained in:
parent
403f063977
commit
b2d72d6603
@ -63,6 +63,12 @@ legal_envvars_bool = (
|
|||||||
# import everything from environment variables
|
# import everything from environment variables
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def str2bool(v):
|
||||||
|
return v.lower() in ("true", "yes", "1")
|
||||||
|
|
||||||
|
|
||||||
for v in legal_envvars:
|
for v in legal_envvars:
|
||||||
|
|
||||||
ret = None
|
ret = None
|
||||||
@ -70,7 +76,9 @@ for v in legal_envvars:
|
|||||||
# secrets feature
|
# secrets feature
|
||||||
if v + '_FILE' in os.environ:
|
if v + '_FILE' in os.environ:
|
||||||
if v in os.environ:
|
if v in os.environ:
|
||||||
raise AttributeError("Both {} and {} are set but are exclusive." .format(v, v + '_FILE'))
|
raise AttributeError(
|
||||||
|
"Both {} and {} are set but are exclusive.".format(
|
||||||
|
v, v + '_FILE'))
|
||||||
with open(os.environ[v + '_FILE']) as f:
|
with open(os.environ[v + '_FILE']) as f:
|
||||||
ret = f.read()
|
ret = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
@ -80,7 +88,7 @@ for v in legal_envvars:
|
|||||||
|
|
||||||
if ret is not None:
|
if ret is not None:
|
||||||
if v in legal_envvars_bool:
|
if v in legal_envvars_bool:
|
||||||
ret = bool(ret)
|
ret = str2bool(ret)
|
||||||
if v in legal_envvars_int:
|
if v in legal_envvars_int:
|
||||||
ret = int(ret)
|
ret = int(ret)
|
||||||
sys.modules[__name__].__dict__[v] = ret
|
sys.modules[__name__].__dict__[v] = ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user