Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added env variable support for himl #55

Merged
merged 2 commits into from
Jul 21, 2021
Merged

Added env variable support for himl #55

merged 2 commits into from
Jul 21, 2021

Conversation

ecojan
Copy link
Collaborator

@ecojan ecojan commented Jul 13, 2021

This PR is meant to bring support to Himl for including environment variables when interpolating.

Description

Added support for HIML to use env variables when interpolating the hierarchy.

Related Issue

Resolves #52

Motivation and Context

See description. Also can be used to include build-time variables in a HIML structure.

How Has This Been Tested?

Tested out by adding a field in one of the examples with

test: {{env(KUBECONFIG)}}

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@ecojan ecojan self-assigned this Jul 13, 2021
README.md Outdated Show resolved Hide resolved
himl/inject_env.py Outdated Show resolved Hide resolved
himl/inject_env.py Outdated Show resolved Hide resolved
return line

# remove {{ and }}
updated_line = line[2:-2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about: key: "prefix-{{env(VAR)}}-suffix" ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to offer support for interpolation with prefix/suffix with environment variables? I was thinking something more similar to the secret resolvers

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess it's enough now

@amuraru
Copy link
Contributor

amuraru commented Jul 14, 2021

also a big gap in him is the lack of unit-tests.
I filed an issue to add a unit test suite for all existing functionality in himl: #56

/cc @danielcoman

himl/interpolation.py Outdated Show resolved Hide resolved
himl/inject_env.py Outdated Show resolved Hide resolved
himl/inject_env.py Outdated Show resolved Hide resolved
@ecojan ecojan merged commit d90ae2e into master Jul 21, 2021
@amuraru amuraru deleted the env-vars-himl branch May 29, 2022 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Retrieve values from environment variables
4 participants