MCPcopy Create free account
hub / github.com/ipython/traitlets / load_config_environ

Method load_config_environ

traitlets/config/application.py:977–996  ·  view source on GitHub ↗

Load config files by environment.

(self)

Source from the content-addressed store, hash-verified

975
976 @catch_config_error
977 def load_config_environ(self) -> None:
978 """Load config files by environment."""
979 PREFIX = self.name.upper().replace("-", "_")
980 new_config = Config()
981
982 self.log.debug('Looping through config variables with prefix "%s"', PREFIX)
983
984 for k, v in os.environ.items():
985 if k.startswith(PREFIX):
986 self.log.debug('Seeing environ "%s"="%s"', k, v)
987 # use __ instead of . as separator in env variable.
988 # Warning, case sensitive !
989 _, *path, key = k.split("__")
990 section = new_config
991 for p in path:
992 section = section[p]
993 setattr(section, key, DeferredConfigString(v))
994
995 new_config.merge(self.cli_config)
996 self.update_config(new_config)
997
998 def _classes_with_config_traits(
999 self, classes: ClassesType | None = None

Callers 1

initializeMethod · 0.80

Calls 4

mergeMethod · 0.95
ConfigClass · 0.90
update_configMethod · 0.80

Tested by

no test coverage detected