Hi, I use a hook to load external credentials as p...
# questions
s
Hi, I use a hook to load external credentials as per https://docs.kedro.org/en/stable/extend/hooks/common_use_cases/#use-hooks-to-load-external-credentials In the hook I would like to use some parameters, like an external url and some other parameters to get external credentials. What is the best practice to store and get such kind of parameters? Are environment variables the only way to achieve this?
Copy code
def after_context_created(self, context):
    creds = get_credentials*(***url***, ***account***)*
Copy code
context.config_loader["credentials"] = {          
         **context.config_loader["credentials"],
**creds
}
s
Hi, environment variables are not the only way, but they are the preferred method for anything sensitive. If you need more advanced interpolation (e.g. defaulting to a fallback if an env var is unset), you can enable OmegaConf's oc.env resolver for all configs by registering it in settings.py. For non-sensitive stuff you can store them in your project's conf/base/parameters.yml. Access them in the hook via context.params.
👍 1