float logic

This commit is contained in:
Raphael Deem 2017-06-26 20:58:31 -07:00
parent ad8e1cbf62
commit 4379a4b067

View File

@ -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
if v.replace('.', '').isdigit():
if '.' in v:
self[config_key] = float(v)
else:
self[config_key] = int(v) self[config_key] = int(v)
else: else:
self[config_key] = v self[config_key] = v