envvars.py 571 B

1234567891011121314
  1. from backend.general.utils.collections import deep_update
  2. from backend.general.utils.settings import get_settings_from_environment
  3. """
  4. This takes env variables with a matching prefix (set by you), strips out the prefix, and adds it to globals
  5. Eg.
  6. export UNTUBE_SETTINGS_IN_DOCKER=true (environment variable)
  7. could be then referenced in the globals() dictionary as
  8. IN_DOCKER (where the value will be set to Pythonic True)
  9. """
  10. # globals() is a dictionary of global variables
  11. deep_update(globals(), get_settings_from_environment(ENVVAR_SETTINGS_PREFIX)) # type: ignore