websauna.system.devop.exportenv module

Export settings and secrets as environment variables to subprocesses.

websauna.system.devop.exportenv.create_settings_env(registry)[source]

Create os.environ where have exported all settings and secrets.

This is used for subprocess to create a child processes which are aware of our settings. All dots are replaced with underscores. The exported environment varible is either prefixed with main or secret. The exported environment variables are uppercased. Parent process environment variables are automatically inherited.

The environment will look like:

MAIN_websauna_SITE_ID=foo
SECRETS_AWS_CONSUMER_KEY=baa

You will also have:

MAIN_SQL_HOST
MAIN_SQL_DATABASE
MAIN_SQL_USER
MAIN_SQL_PASSWORD

Integers, booleans and objects are exported as strings:

MAIN_SOME_BOOLEAN=True MAIN_SOME_INTEGER=123