float logic
This commit is contained in:
parent
ad8e1cbf62
commit
4379a4b067
|
@ -201,7 +201,11 @@ 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)
|
||||||
if v.isdigit():
|
# This is a float or an int
|
||||||
self[config_key] = int(v)
|
if v.replace('.', '').isdigit():
|
||||||
|
if '.' in v:
|
||||||
|
self[config_key] = float(v)
|
||||||
|
else:
|
||||||
|
self[config_key] = int(v)
|
||||||
else:
|
else:
|
||||||
self[config_key] = v
|
self[config_key] = v
|
||||||
|
|
Loading…
Reference in New Issue
Block a user