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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support variable expansion in .env: "VAR1=${VAR2:-default}" #4239

Merged
merged 2 commits into from
Apr 15, 2024

Conversation

andreafalzetti
Copy link
Contributor

Proposed changes

Fixes DEV-279

Currently, the .env does not support default values for variables. The library go-dotenv doesn't support the notation VAR="${VAR:-default}". (see joho/godotenv#211).

With this change the Okteto CLI will be able to expand the vars in the .env adding support for such scenario.

How to validate

  1. Using latest stable test
  2. Using the following manifest:
deploy:
  - env
  1. Using the following .env file:
ANDREA="${ANDREA_DEFAULT:-foo}"
KEY='this is
a multiline
variable'
TEST=true
  1. Run okteto deploy
  2. Observe how TEST and KEY are populated correctly, while ANDREA is :-foo}

Repeat the steps with the changes and observe how all vars work as expected, by default you should get ANDREA=foo. If you run ANDREA_DEAULT=testvalue okd deploy observe the value ANDREA=testvalue in the output.

CLI Quality Reminders 馃敡

For both authors and reviewers:

  • Scrutinize for potential regressions
  • Ensure key automated tests are in place
  • Build the CLI and test using the validation steps
  • Assess Developer Experience impact (log messages, performances, etc)
  • If too broad, consider breaking into smaller PRs
  • Adhere to our code style and code review guidelines

@andreafalzetti andreafalzetti marked this pull request as ready for review April 13, 2024 18:29
@andreafalzetti andreafalzetti requested a review from a team as a code owner April 13, 2024 18:29
@andreafalzetti andreafalzetti merged commit 10d1b46 into master Apr 15, 2024
14 of 16 checks passed
@andreafalzetti andreafalzetti deleted the af/manifest-vars-dev-56-2 branch April 15, 2024 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants