question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow users to pass credentials through environment variables

See original GitHub issue

Description

In the new config loader (https://github.com/kedro-org/kedro/issues/1868), allow users to pass credentials through environment variables using the OmegaConf resolver oc.env: https://omegaconf.readthedocs.io/en/latest/custom_resolvers.html#oc-env

Context

The “default” way for Kedro to deal with credentials is through the credentials.yml file. @AntonyMilneQB has explained very thoroughly how this works and why it’s problematic here: https://github.com/kedro-org/kedro/issues/1646

Over time many users have flagged that they want to be able to pass credentials through environment variables. Currently, this is possible if users use the TemplatedConfigLoader, but ideally this functionality would be available by default.

Insight 11 of the configuration research also showed that users are currently storing credentials in environment variables: https://github.com/kedro-org/kedro/issues/1847

Implementation

  • The new configloader will use OmegaConf instead of anyconf https://github.com/kedro-org/kedro/issues/1868

  • The built-in resolvers will be turned off

  • In this task add logic to load credentials using OmegaConf with the oc.env resolver turned on. This might mean separating the credentials loading logic so that the resolver for that loading process hasn’t been turned off. If this is impossible or really difficult, we’ll allow env variables for all config, but that should be discussed.

  • Document how should users pass credentials - as current way to do it is via `TemplatedConfigLoader

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
szczelescommented, Oct 20, 2022

@MerelTheisenQB Thanks for asking! I’ve added 2 more comments with challenges that we faced with the current configuration parsing logic during Kedro deployments:

1reaction
szczelescommented, Oct 19, 2022

@MerelTheisenQB That’s a great idea to move to the config framework that supports env variables! In kedro-kubeflow plugin we provide custom EnvTemplatedConfigLoader, for example, to fulfill a requirement of adjusting the docker image name to the current commit when running the pipeline in Kubeflow Pipelines environment (see https://github.com/getindata/kedro-kubeflow/blob/0.7.3/kedro_kubeflow/context_helper.py#L13)

Having this solved out-of-the-box by OmegaConf looks really neat!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling Passwords and Secret Keys using Environment ...
In this post we will learn how to save important credentials in environment variables and access them in python script.
Read more >
Keep your code secure by using environment variables and ...
Let's enrich this beautiful environment with some variables (image by Rob Morton on Unsplash). Your code needs to connect to a database.
Read more >
How to Protect your Credentials using Environment Variables ...
In this blog, I'll share 3 ways to hide your credentials in Jupyter notebook and Environment Variables using Mac. Let's dive in!
Read more >
Using credentials from environment variables - AWS SDK for ...
To authenticate to Amazon Web Services, the SDK first checks for credentials in your environment variables. The SDK uses the getenv() function to...
Read more >
Is it secure to store passwords as environment variables ...
Are you trying to prevent your users from sprinkling passwords all over their file systems where they are likely to be forgotten and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found