We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[bug]Clean Python pip install problem
**Describe the bug**
If starting a new Python installation, DynaConf 2.1.0 will not work successfully.  It appears to be choking while reading a YAML file.  The only workaround I have found is to roll back to 2.0.4.


**To Reproduce**
Steps to reproduce the behavior:
I have put together a very simple project that will demonstrate the problem, see the attached zip file below.  Just make sure you are using a brand new installation of Python - System, VirtualEnv or Conda Environment - problem occurs in all cases.  Just for clarity, I use Conda.

pip install -r requirements.txt
python dc-error.py


**Expected behavior**
The program should run and print out the setting from the error.yaml file.


**Debug output**
C:\ProgramData\Anaconda3\envs\DynaConfError\python.exe C:/Development/DynaConfError/dc-error.py
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\envs\DynaConfError\lib\site-packages\dynaconf\loaders\base.py", line 110, in _read
    data = source_data[env.lower()]
KeyError: 'dynaconf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Development/DynaConfError/dc-error.py", line 11, in <module>
    settings.load_file(path='error.yaml', silent=False)
  File "C:\ProgramData\Anaconda3\envs\DynaConfError\lib\site-packages\dynaconf\base.py", line 908, in load_file
    filename=path,
  File "C:\ProgramData\Anaconda3\envs\DynaConfError\lib\site-packages\dynaconf\loaders\__init__.py", line 116, in settings_loader
    obj, filename=mod_file, env=env, silent=silent, key=key
  File "C:\ProgramData\Anaconda3\envs\DynaConfError\lib\site-packages\dynaconf\loaders\yaml_loader.py", line 50, in load
    loader.load(filename=filename, key=key, silent=silent)
  File "C:\ProgramData\Anaconda3\envs\DynaConfError\lib\site-packages\dynaconf\loaders\base.py", line 71, in load
    self._read(files, env_list, silent, key)
  File "C:\ProgramData\Anaconda3\envs\DynaConfError\lib\site-packages\dynaconf\loaders\base.py", line 125, in _read
    raise KeyError(message)
KeyError: 'yaml_loader: dynaconf env not defined in C:\\Development\\DynaConfError\\.\\error.yaml'


**Environment (please complete the following information):**
 - OS: Windows 10 Pro, Ubuntu 18.04, CentOS 7
 - Dynaconf Version 2.1.0
 - Frameworks in use:  None


**Additional context**
Interestingly, if you already had an older version of DynaConf installed in a python environment and update it, this code will execute and work as expected.


[DynaConfError.zip](https://github.com/rochacbruno/dynaconf/files/3598272/DynaConfError.zip)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `dynaconf/loaders/base.py`
Content:
```
1 import io
2 import os
3 
4 from dynaconf.utils import build_env_list
5 from dynaconf.utils import ensure_a_list
6 from dynaconf.utils import raw_logger
7 
8 
9 logger = raw_logger()
10 
11 
12 class BaseLoader(object):
13     """Base loader for dynaconf source files.
14 
15     :param obj: {[LazySettings]} -- [Dynaconf settings]
16     :param env: {[string]} -- [the current env to be loaded defaults to
17       [development]]
18     :param identifier: {[string]} -- [identifier ini, yaml, json, py, toml]
19     :param extensions: {[list]} -- [List of extensions with dots ['.a', '.b']]
20     :param file_reader: {[callable]} -- [reads file return dict]
21     :param string_reader: {[callable]} -- [reads string return dict]
22     """
23 
24     def __init__(
25         self, obj, env, identifier, extensions, file_reader, string_reader
26     ):
27         """Instantiates a loader for different sources"""
28         self.obj = obj
29         self.env = env or obj.current_env
30         self.identifier = identifier
31         self.extensions = extensions
32         self.file_reader = file_reader
33         self.string_reader = string_reader
34 
35     @staticmethod
36     def warn_not_installed(obj, identifier):  # pragma: no cover
37         if identifier not in obj._not_installed_warnings:
38             logger.warning(
39                 "%(ident)s support is not installed in your environment. "
40                 "`pip install dynaconf[%(ident)s]`",
41                 {"ident": identifier},
42             )
43         obj._not_installed_warnings.append(identifier)
44 
45     def load(self, filename=None, key=None, silent=True):
46         """
47         Reads and loads in to `self.obj` a single key or all keys from source
48 
49         :param filename: Optional filename to load
50         :param key: if provided load a single key
51         :param silent: if load erros should be silenced
52         """
53         filename = filename or self.obj.get(self.identifier.upper())
54         if not filename:
55             return
56 
57         if not isinstance(filename, (list, tuple)):
58             split_files = ensure_a_list(filename)
59             if all([f.endswith(self.extensions) for f in split_files]):  # noqa
60                 files = split_files  # it is a ['file.ext', ...]
61             else:  # it is a single config as string
62                 files = [filename]
63         else:  # it is already a list/tuple
64             files = filename
65 
66         self.obj._loaded_files.extend(files)
67 
68         env_list = build_env_list(self.obj, self.env)
69 
70         # load all envs
71         self._read(files, env_list, silent, key)
72 
73     def _read(self, files, envs, silent=True, key=None):
74         for source_file in files:
75             if source_file.endswith(self.extensions):
76                 try:
77                     with io.open(
78                         source_file,
79                         encoding=self.obj.get(
80                             "ENCODING_FOR_DYNACONF", "utf-8"
81                         ),
82                     ) as open_file:
83                         source_data = self.file_reader(open_file)
84                     self.obj.logger.debug(
85                         "{}_loader: {}".format(self.identifier, source_file)
86                     )
87                 except IOError:
88                     self.obj.logger.debug(
89                         "{}_loader: {} (Ignored, file not Found)".format(
90                             self.identifier, source_file
91                         )
92                     )
93                     source_data = None
94             else:
95                 # for tests it is possible to pass string
96                 source_data = self.string_reader(source_file)
97 
98             if not source_data:
99                 continue
100 
101             # env name is checked in lower
102             source_data = {
103                 k.lower(): value for k, value in source_data.items()
104             }
105 
106             for env in envs:
107 
108                 data = {}
109                 try:
110                     data = source_data[env.lower()]
111                 except KeyError:
112                     if env not in (
113                         self.obj.get("ENVVAR_PREFIX_FOR_DYNACONF")
114                         or "DYNACONF",
115                         "GLOBAL",
116                     ):
117                         message = "%s_loader: %s env not defined in %s" % (
118                             self.identifier,
119                             env,
120                             source_file,
121                         )
122                         if silent:
123                             self.obj.logger.warning(message)
124                         else:
125                             raise KeyError(message)
126                     continue
127 
128                 if (
129                     env.lower()
130                     != self.obj.get("DEFAULT_ENV_FOR_DYNACONF").lower()
131                 ):
132                     identifier = "{0}_{1}".format(self.identifier, env.lower())
133                 else:
134                     identifier = self.identifier
135 
136                 # data 1st level keys should be transformed to upper case.
137                 data = {k.upper(): v for k, v in data.items()}
138                 if key:
139                     key = key.upper()
140 
141                 is_secret = "secret" in source_file
142 
143                 self.obj.logger.debug(
144                     "{}_loader: {}[{}]{}".format(
145                         self.identifier,
146                         os.path.split(source_file)[-1],
147                         env.lower(),
148                         list(data.keys()) if is_secret else data,
149                     )
150                 )
151 
152                 if not key:
153                     self.obj.update(
154                         data, loader_identifier=identifier, is_secret=is_secret
155                     )
156                 elif key in data:
157                     self.obj.set(
158                         key,
159                         data.get(key),
160                         loader_identifier=identifier,
161                         is_secret=is_secret,
162                     )
163
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/dynaconf/loaders/base.py b/dynaconf/loaders/base.py
--- a/dynaconf/loaders/base.py
+++ b/dynaconf/loaders/base.py
@@ -103,17 +103,27 @@
                 k.lower(): value for k, value in source_data.items()
             }
 
-            for env in envs:
+            # all lower case for comparison
+            base_envs = [
+                # DYNACONF or MYPROGRAM
+                (self.obj.get("ENVVAR_PREFIX_FOR_DYNACONF") or "").lower(),
+                # DEFAULT
+                self.obj.get("DEFAULT_ENV_FOR_DYNACONF").lower(),
+                # default active env unless ENV_FOR_DYNACONF is changed
+                "development",
+                # backwards compatibility for global
+                "dynaconf",
+                # global that rules all
+                "global",
+            ]
 
+            for env in envs:
+                env = env.lower()  # lower for better comparison
                 data = {}
                 try:
-                    data = source_data[env.lower()]
+                    data = source_data[env]
                 except KeyError:
-                    if env not in (
-                        self.obj.get("ENVVAR_PREFIX_FOR_DYNACONF")
-                        or "DYNACONF",
-                        "GLOBAL",
-                    ):
+                    if env not in base_envs:
                         message = "%s_loader: %s env not defined in %s" % (
                             self.identifier,
                             env,
@@ -125,11 +135,8 @@
                             raise KeyError(message)
                     continue
 
-                if (
-                    env.lower()
-                    != self.obj.get("DEFAULT_ENV_FOR_DYNACONF").lower()
-                ):
-                    identifier = "{0}_{1}".format(self.identifier, env.lower())
+                if env != self.obj.get("DEFAULT_ENV_FOR_DYNACONF").lower():
+                    identifier = "{0}_{1}".format(self.identifier, env)
                 else:
                     identifier = self.identifier
 
@@ -144,7 +151,7 @@
                     "{}_loader: {}[{}]{}".format(
                         self.identifier,
                         os.path.split(source_file)[-1],
-                        env.lower(),
+                        env,
                         list(data.keys()) if is_secret else data,
                     )
                 )

{"golden_diff": "diff --git a/dynaconf/loaders/base.py b/dynaconf/loaders/base.py\n--- a/dynaconf/loaders/base.py\n+++ b/dynaconf/loaders/base.py\n@@ -103,17 +103,27 @@\n                 k.lower(): value for k, value in source_data.items()\n             }\n \n-            for env in envs:\n+            # all lower case for comparison\n+            base_envs = [\n+                # DYNACONF or MYPROGRAM\n+                (self.obj.get(\"ENVVAR_PREFIX_FOR_DYNACONF\") or \"\").lower(),\n+                # DEFAULT\n+                self.obj.get(\"DEFAULT_ENV_FOR_DYNACONF\").lower(),\n+                # default active env unless ENV_FOR_DYNACONF is changed\n+                \"development\",\n+                # backwards compatibility for global\n+                \"dynaconf\",\n+                # global that rules all\n+                \"global\",\n+            ]\n \n+            for env in envs:\n+                env = env.lower()  # lower for better comparison\n                 data = {}\n                 try:\n-                    data = source_data[env.lower()]\n+                    data = source_data[env]\n                 except KeyError:\n-                    if env not in (\n-                        self.obj.get(\"ENVVAR_PREFIX_FOR_DYNACONF\")\n-                        or \"DYNACONF\",\n-                        \"GLOBAL\",\n-                    ):\n+                    if env not in base_envs:\n                         message = \"%s_loader: %s env not defined in %s\" % (\n                             self.identifier,\n                             env,\n@@ -125,11 +135,8 @@\n                             raise KeyError(message)\n                     continue\n \n-                if (\n-                    env.lower()\n-                    != self.obj.get(\"DEFAULT_ENV_FOR_DYNACONF\").lower()\n-                ):\n-                    identifier = \"{0}_{1}\".format(self.identifier, env.lower())\n+                if env != self.obj.get(\"DEFAULT_ENV_FOR_DYNACONF\").lower():\n+                    identifier = \"{0}_{1}\".format(self.identifier, env)\n                 else:\n                     identifier = self.identifier\n \n@@ -144,7 +151,7 @@\n                     \"{}_loader: {}[{}]{}\".format(\n                         self.identifier,\n                         os.path.split(source_file)[-1],\n-                        env.lower(),\n+                        env,\n                         list(data.keys()) if is_secret else data,\n                     )\n                 )\n", "issue": "[bug]Clean Python pip install problem\n**Describe the bug**\r\nIf starting a new Python installation, DynaConf 2.1.0 will not work successfully.  It appears to be choking while reading a YAML file.  The only workaround I have found is to roll back to 2.0.4.\r\n\r\n\r\n**To Reproduce**\r\nSteps to reproduce the behavior:\r\nI have put together a very simple project that will demonstrate the problem, see the attached zip file below.  Just make sure you are using a brand new installation of Python - System, VirtualEnv or Conda Environment - problem occurs in all cases.  Just for clarity, I use Conda.\r\n\r\npip install -r requirements.txt\r\npython dc-error.py\r\n\r\n\r\n**Expected behavior**\r\nThe program should run and print out the setting from the error.yaml file.\r\n\r\n\r\n**Debug output**\r\nC:\\ProgramData\\Anaconda3\\envs\\DynaConfError\\python.exe C:/Development/DynaConfError/dc-error.py\r\nTraceback (most recent call last):\r\n  File \"C:\\ProgramData\\Anaconda3\\envs\\DynaConfError\\lib\\site-packages\\dynaconf\\loaders\\base.py\", line 110, in _read\r\n    data = source_data[env.lower()]\r\nKeyError: 'dynaconf'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"C:/Development/DynaConfError/dc-error.py\", line 11, in <module>\r\n    settings.load_file(path='error.yaml', silent=False)\r\n  File \"C:\\ProgramData\\Anaconda3\\envs\\DynaConfError\\lib\\site-packages\\dynaconf\\base.py\", line 908, in load_file\r\n    filename=path,\r\n  File \"C:\\ProgramData\\Anaconda3\\envs\\DynaConfError\\lib\\site-packages\\dynaconf\\loaders\\__init__.py\", line 116, in settings_loader\r\n    obj, filename=mod_file, env=env, silent=silent, key=key\r\n  File \"C:\\ProgramData\\Anaconda3\\envs\\DynaConfError\\lib\\site-packages\\dynaconf\\loaders\\yaml_loader.py\", line 50, in load\r\n    loader.load(filename=filename, key=key, silent=silent)\r\n  File \"C:\\ProgramData\\Anaconda3\\envs\\DynaConfError\\lib\\site-packages\\dynaconf\\loaders\\base.py\", line 71, in load\r\n    self._read(files, env_list, silent, key)\r\n  File \"C:\\ProgramData\\Anaconda3\\envs\\DynaConfError\\lib\\site-packages\\dynaconf\\loaders\\base.py\", line 125, in _read\r\n    raise KeyError(message)\r\nKeyError: 'yaml_loader: dynaconf env not defined in C:\\\\Development\\\\DynaConfError\\\\.\\\\error.yaml'\r\n\r\n\r\n**Environment (please complete the following information):**\r\n - OS: Windows 10 Pro, Ubuntu 18.04, CentOS 7\r\n - Dynaconf Version 2.1.0\r\n - Frameworks in use:  None\r\n\r\n\r\n**Additional context**\r\nInterestingly, if you already had an older version of DynaConf installed in a python environment and update it, this code will execute and work as expected.\r\n\r\n\r\n[DynaConfError.zip](https://github.com/rochacbruno/dynaconf/files/3598272/DynaConfError.zip)\r\n\n", "before_files": [{"content": "import io\nimport os\n\nfrom dynaconf.utils import build_env_list\nfrom dynaconf.utils import ensure_a_list\nfrom dynaconf.utils import raw_logger\n\n\nlogger = raw_logger()\n\n\nclass BaseLoader(object):\n    \"\"\"Base loader for dynaconf source files.\n\n    :param obj: {[LazySettings]} -- [Dynaconf settings]\n    :param env: {[string]} -- [the current env to be loaded defaults to\n      [development]]\n    :param identifier: {[string]} -- [identifier ini, yaml, json, py, toml]\n    :param extensions: {[list]} -- [List of extensions with dots ['.a', '.b']]\n    :param file_reader: {[callable]} -- [reads file return dict]\n    :param string_reader: {[callable]} -- [reads string return dict]\n    \"\"\"\n\n    def __init__(\n        self, obj, env, identifier, extensions, file_reader, string_reader\n    ):\n        \"\"\"Instantiates a loader for different sources\"\"\"\n        self.obj = obj\n        self.env = env or obj.current_env\n        self.identifier = identifier\n        self.extensions = extensions\n        self.file_reader = file_reader\n        self.string_reader = string_reader\n\n    @staticmethod\n    def warn_not_installed(obj, identifier):  # pragma: no cover\n        if identifier not in obj._not_installed_warnings:\n            logger.warning(\n                \"%(ident)s support is not installed in your environment. \"\n                \"`pip install dynaconf[%(ident)s]`\",\n                {\"ident\": identifier},\n            )\n        obj._not_installed_warnings.append(identifier)\n\n    def load(self, filename=None, key=None, silent=True):\n        \"\"\"\n        Reads and loads in to `self.obj` a single key or all keys from source\n\n        :param filename: Optional filename to load\n        :param key: if provided load a single key\n        :param silent: if load erros should be silenced\n        \"\"\"\n        filename = filename or self.obj.get(self.identifier.upper())\n        if not filename:\n            return\n\n        if not isinstance(filename, (list, tuple)):\n            split_files = ensure_a_list(filename)\n            if all([f.endswith(self.extensions) for f in split_files]):  # noqa\n                files = split_files  # it is a ['file.ext', ...]\n            else:  # it is a single config as string\n                files = [filename]\n        else:  # it is already a list/tuple\n            files = filename\n\n        self.obj._loaded_files.extend(files)\n\n        env_list = build_env_list(self.obj, self.env)\n\n        # load all envs\n        self._read(files, env_list, silent, key)\n\n    def _read(self, files, envs, silent=True, key=None):\n        for source_file in files:\n            if source_file.endswith(self.extensions):\n                try:\n                    with io.open(\n                        source_file,\n                        encoding=self.obj.get(\n                            \"ENCODING_FOR_DYNACONF\", \"utf-8\"\n                        ),\n                    ) as open_file:\n                        source_data = self.file_reader(open_file)\n                    self.obj.logger.debug(\n                        \"{}_loader: {}\".format(self.identifier, source_file)\n                    )\n                except IOError:\n                    self.obj.logger.debug(\n                        \"{}_loader: {} (Ignored, file not Found)\".format(\n                            self.identifier, source_file\n                        )\n                    )\n                    source_data = None\n            else:\n                # for tests it is possible to pass string\n                source_data = self.string_reader(source_file)\n\n            if not source_data:\n                continue\n\n            # env name is checked in lower\n            source_data = {\n                k.lower(): value for k, value in source_data.items()\n            }\n\n            for env in envs:\n\n                data = {}\n                try:\n                    data = source_data[env.lower()]\n                except KeyError:\n                    if env not in (\n                        self.obj.get(\"ENVVAR_PREFIX_FOR_DYNACONF\")\n                        or \"DYNACONF\",\n                        \"GLOBAL\",\n                    ):\n                        message = \"%s_loader: %s env not defined in %s\" % (\n                            self.identifier,\n                            env,\n                            source_file,\n                        )\n                        if silent:\n                            self.obj.logger.warning(message)\n                        else:\n                            raise KeyError(message)\n                    continue\n\n                if (\n                    env.lower()\n                    != self.obj.get(\"DEFAULT_ENV_FOR_DYNACONF\").lower()\n                ):\n                    identifier = \"{0}_{1}\".format(self.identifier, env.lower())\n                else:\n                    identifier = self.identifier\n\n                # data 1st level keys should be transformed to upper case.\n                data = {k.upper(): v for k, v in data.items()}\n                if key:\n                    key = key.upper()\n\n                is_secret = \"secret\" in source_file\n\n                self.obj.logger.debug(\n                    \"{}_loader: {}[{}]{}\".format(\n                        self.identifier,\n                        os.path.split(source_file)[-1],\n                        env.lower(),\n                        list(data.keys()) if is_secret else data,\n                    )\n                )\n\n                if not key:\n                    self.obj.update(\n                        data, loader_identifier=identifier, is_secret=is_secret\n                    )\n                elif key in data:\n                    self.obj.set(\n                        key,\n                        data.get(key),\n                        loader_identifier=identifier,\n                        is_secret=is_secret,\n                    )\n", "path": "dynaconf/loaders/base.py"}], "after_files": [{"content": "import io\nimport os\n\nfrom dynaconf.utils import build_env_list\nfrom dynaconf.utils import ensure_a_list\nfrom dynaconf.utils import raw_logger\n\n\nlogger = raw_logger()\n\n\nclass BaseLoader(object):\n    \"\"\"Base loader for dynaconf source files.\n\n    :param obj: {[LazySettings]} -- [Dynaconf settings]\n    :param env: {[string]} -- [the current env to be loaded defaults to\n      [development]]\n    :param identifier: {[string]} -- [identifier ini, yaml, json, py, toml]\n    :param extensions: {[list]} -- [List of extensions with dots ['.a', '.b']]\n    :param file_reader: {[callable]} -- [reads file return dict]\n    :param string_reader: {[callable]} -- [reads string return dict]\n    \"\"\"\n\n    def __init__(\n        self, obj, env, identifier, extensions, file_reader, string_reader\n    ):\n        \"\"\"Instantiates a loader for different sources\"\"\"\n        self.obj = obj\n        self.env = env or obj.current_env\n        self.identifier = identifier\n        self.extensions = extensions\n        self.file_reader = file_reader\n        self.string_reader = string_reader\n\n    @staticmethod\n    def warn_not_installed(obj, identifier):  # pragma: no cover\n        if identifier not in obj._not_installed_warnings:\n            logger.warning(\n                \"%(ident)s support is not installed in your environment. \"\n                \"`pip install dynaconf[%(ident)s]`\",\n                {\"ident\": identifier},\n            )\n        obj._not_installed_warnings.append(identifier)\n\n    def load(self, filename=None, key=None, silent=True):\n        \"\"\"\n        Reads and loads in to `self.obj` a single key or all keys from source\n\n        :param filename: Optional filename to load\n        :param key: if provided load a single key\n        :param silent: if load erros should be silenced\n        \"\"\"\n        filename = filename or self.obj.get(self.identifier.upper())\n        if not filename:\n            return\n\n        if not isinstance(filename, (list, tuple)):\n            split_files = ensure_a_list(filename)\n            if all([f.endswith(self.extensions) for f in split_files]):  # noqa\n                files = split_files  # it is a ['file.ext', ...]\n            else:  # it is a single config as string\n                files = [filename]\n        else:  # it is already a list/tuple\n            files = filename\n\n        self.obj._loaded_files.extend(files)\n\n        env_list = build_env_list(self.obj, self.env)\n\n        # load all envs\n        self._read(files, env_list, silent, key)\n\n    def _read(self, files, envs, silent=True, key=None):\n        for source_file in files:\n            if source_file.endswith(self.extensions):\n                try:\n                    with io.open(\n                        source_file,\n                        encoding=self.obj.get(\n                            \"ENCODING_FOR_DYNACONF\", \"utf-8\"\n                        ),\n                    ) as open_file:\n                        source_data = self.file_reader(open_file)\n                    self.obj.logger.debug(\n                        \"{}_loader: {}\".format(self.identifier, source_file)\n                    )\n                except IOError:\n                    self.obj.logger.debug(\n                        \"{}_loader: {} (Ignored, file not Found)\".format(\n                            self.identifier, source_file\n                        )\n                    )\n                    source_data = None\n            else:\n                # for tests it is possible to pass string\n                source_data = self.string_reader(source_file)\n\n            if not source_data:\n                continue\n\n            # env name is checked in lower\n            source_data = {\n                k.lower(): value for k, value in source_data.items()\n            }\n\n            # all lower case for comparison\n            base_envs = [\n                # DYNACONF or MYPROGRAM\n                (self.obj.get(\"ENVVAR_PREFIX_FOR_DYNACONF\") or \"\").lower(),\n                # DEFAULT\n                self.obj.get(\"DEFAULT_ENV_FOR_DYNACONF\").lower(),\n                # default active env unless ENV_FOR_DYNACONF is changed\n                \"development\",\n                # backwards compatibility for global\n                \"dynaconf\",\n                # global that rules all\n                \"global\",\n            ]\n\n            for env in envs:\n                env = env.lower()  # lower for better comparison\n                data = {}\n                try:\n                    data = source_data[env]\n                except KeyError:\n                    if env not in base_envs:\n                        message = \"%s_loader: %s env not defined in %s\" % (\n                            self.identifier,\n                            env,\n                            source_file,\n                        )\n                        if silent:\n                            self.obj.logger.warning(message)\n                        else:\n                            raise KeyError(message)\n                    continue\n\n                if env != self.obj.get(\"DEFAULT_ENV_FOR_DYNACONF\").lower():\n                    identifier = \"{0}_{1}\".format(self.identifier, env)\n                else:\n                    identifier = self.identifier\n\n                # data 1st level keys should be transformed to upper case.\n                data = {k.upper(): v for k, v in data.items()}\n                if key:\n                    key = key.upper()\n\n                is_secret = \"secret\" in source_file\n\n                self.obj.logger.debug(\n                    \"{}_loader: {}[{}]{}\".format(\n                        self.identifier,\n                        os.path.split(source_file)[-1],\n                        env,\n                        list(data.keys()) if is_secret else data,\n                    )\n                )\n\n                if not key:\n                    self.obj.update(\n                        data, loader_identifier=identifier, is_secret=is_secret\n                    )\n                elif key in data:\n                    self.obj.set(\n                        key,\n                        data.get(key),\n                        loader_identifier=identifier,\n                        is_secret=is_secret,\n                    )\n", "path": "dynaconf/loaders/base.py"}]}