rename to FLASK_SKIP_DOTENV, add docs, test

This commit is contained in:
David Lord 2018-04-28 08:07:53 -07:00
parent bac5d6b9f4
commit 5965cb7e1c
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
4 changed files with 50 additions and 7 deletions

View file

@ -68,6 +68,21 @@ def get_debug_flag():
return val.lower() not in ('0', 'false', 'no')
def get_load_dotenv(default=True):
"""Get whether the user has disabled loading dotenv files by setting
:envvar:`FLASK_SKIP_DOTENV`. The default is ``True``, load the
files.
:param default: What to return if the env var isn't set.
"""
val = os.environ.get('FLASK_SKIP_DOTENV')
if not val:
return default
return val.lower() in ('0', 'false', 'no')
def _endpoint_from_view_func(view_func):
"""Internal helper that returns the default endpoint for a given
function. This always is the function name.