convert environment vars to int if digits

This commit is contained in:
Raphael Deem 2017-06-26 20:49:41 -07:00
parent dbcbf12456
commit ad8e1cbf62

View File

@ -201,4 +201,7 @@ 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():
self[config_key] = int(v)
else:
self[config_key] = v self[config_key] = v