Merge pull request #819 from r0fls/817
convert environment vars to int if digits
This commit is contained in:
commit
529f5822ee
|
@ -201,4 +201,10 @@ class Config(dict):
|
||||||
for k, v in os.environ.items():
|
for k, v in os.environ.items():
|
||||||
if k.startswith(SANIC_PREFIX):
|
if k.startswith(SANIC_PREFIX):
|
||||||
_, config_key = k.split(SANIC_PREFIX, 1)
|
_, config_key = k.split(SANIC_PREFIX, 1)
|
||||||
self[config_key] = v
|
try:
|
||||||
|
self[config_key] = int(v)
|
||||||
|
except ValueError:
|
||||||
|
try:
|
||||||
|
self[config_key] = float(v)
|
||||||
|
except ValueError:
|
||||||
|
self[config_key] = v
|
||||||
|
|
Loading…
Reference in New Issue
Block a user