diff --git a/sanic/config.py b/sanic/config.py index 6ffcf7a1..6a53e476 100644 --- a/sanic/config.py +++ b/sanic/config.py @@ -195,14 +195,14 @@ class Config(dict): if key.isupper(): self[key] = getattr(obj, key) - def load_environment_vars(self): + def load_environment_vars(self, prefix=SANIC_PREFIX): """ - Looks for any ``SANIC_`` prefixed environment variables and applies + Looks for prefixed environment variables and applies them to the configuration if present. """ for k, v in os.environ.items(): - if k.startswith(SANIC_PREFIX): - _, config_key = k.split(SANIC_PREFIX, 1) + if k.startswith(prefix): + _, config_key = k.split(prefix, 1) try: self[config_key] = int(v) except ValueError: