This PR adds a keyword argument env_vars to the PassboltAPI initializer that will be passed to configparser.ConfigParser and used to interpolate any variables provided in env_vars. Does not break any existing API use.
If you pass in an environment variable, for example a variable FOO:
import os
PassboltAPI(config_path='config.ini', env_vars=os.environ)
you can use that variable inside the config.ini file via:
bar=%(FOO)s
If the variable is present both in the env_vars dictionary and the config.ini file then the config.ini value takes precedence.
What you cannot do is use the same name for a variable you are defining and one that you are passing in, such as:
This PR adds a keyword argument env_vars to the PassboltAPI initializer that will be passed to
configparser.ConfigParser
and used to interpolate any variables provided in env_vars. Does not break any existing API use.If you pass in an environment variable, for example a variable
FOO
:you can use that variable inside the config.ini file via:
If the variable is present both in the env_vars dictionary and the config.ini file then the config.ini value takes precedence.
What you cannot do is use the same name for a variable you are defining and one that you are passing in, such as:
That will result in a recursion error.