Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Support set/unset environment variables through tanzu config file #1086

Merged
merged 1 commit into from
Nov 9, 2021

Conversation

anujc25
Copy link
Contributor

@anujc25 anujc25 commented Nov 8, 2021

What this PR does / why we need it

  • The change allows users to configure env variables as part of tanzu
    config file

  • Env configuration can be set using tanzu config set env.<variable> <value>
    command

  • User can unset the already configured settings with new tanzu config unset env.<variable> command

  • In the case of conflicts, meaning user has set environment variable
    outside tanzu config file with export FOO=bar and as part of tanzu
    config file, higer precedence is given to user configured environment
    variable to allow user to override config for one off command runs

  • Sample configuration file:

apiVersion: config.tanzu.vmware.com/v1alpha1
clientOptions:
  env:
    global:
      FOO: bar
      FOO1: baz

Which issue(s) this PR fixes

Fixes #1035

Describe testing done for PR

Manual testing

- tanzu config set env.global.FOO bar
- tanzu config set env..global.FOO1 baz
- tanzu config unset env.global.FOO
- tanzu config unset env.global.FOO1

Release note

Support set/unset environment variables through tanzu config file

PR Checklist

  • Squash the commits into one or a small number of logical commits
  • Use good commit messages
  • Ensure PR contains terms all contributors can understand and links all contributors can access

Additional information

Special notes for your reviewer

Copy link
Contributor

@vuil vuil left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@vuil vuil self-assigned this Nov 8, 2021
@vuil vuil added kind/feature Categorizes issue or PR as related to a new feature area/cli labels Nov 8, 2021
@vuil
Copy link
Contributor

vuil commented Nov 8, 2021

@anujc25 please add a release note to mention the update to the commands

- The change allows users to configure env variables as part of tanzu
  config file
- Env configuration can be set using `tanzu config set env.global.<variable>
  <value>` or `tanzu config set env.<plugin>.<variable>` command
- User can unset the already configured settings with new `tanzu config
  unset env.<plugin>.<variable>` command
- In the case of conflicts, meaning user has set environment variable
  outside tanzu config file with `export FOO=bar` and as part of tanzu
  config file, higer precedence is given to user configured environment
  variable to allow user to override config for one off command runs
@anujc25 anujc25 added the ok-to-merge PRs should be labelled with this before merging label Nov 9, 2021
@anujc25 anujc25 merged commit 86aefec into vmware-tanzu:main Nov 9, 2021
yharish991 pushed a commit to yharish991/tanzu-framework that referenced this pull request Nov 9, 2021
…ware-tanzu#1086)

- The change allows users to configure env variables as part of tanzu
  config file
- Env configuration can be set using `tanzu config set env.global.<variable>
  <value>` or `tanzu config set env.<plugin>.<variable>` command
- User can unset the already configured settings with new `tanzu config
  unset env.<plugin>.<variable>` command
- In the case of conflicts, meaning user has set environment variable
  outside tanzu config file with `export FOO=bar` and as part of tanzu
  config file, higer precedence is given to user configured environment
  variable to allow user to override config for one off command runs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/cli cla-not-required kind/feature Categorizes issue or PR as related to a new feature ok-to-merge PRs should be labelled with this before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow configuring generic configuration/environment variable in Tanzu config file
3 participants