feat: add METAL_CONFIG as alternative to --config#420
Merged
Conversation
Nearly all --args can be supplied as METAL_{ARG} because we take advantage of Viper's AutomaticEnv feature.
The code that configures this and runs this happens after the config file option is detected and read in.
In order to support METAL_CONFIG, we have to check for it explicitly.
Signed-off-by: Marques Johansson <[email protected]>
Signed-off-by: Marques Johansson <[email protected]>
8c3b9d0 to
6c58eb1
Compare
ctreatma
approved these changes
Jan 5, 2024
aayushrangwala
pushed a commit
to aayushrangwala/metal-cli
that referenced
this pull request
Jan 9, 2024
Nearly all --args can be supplied as METAL_{ARG} because we take
advantage of Viper's AutomaticEnv feature.
The code that configures this and runs this happens after the config
file option is detected and read in.
In order to support METAL_CONFIG, we have to check for it explicitly.
Fixes equinix#360
## How has this been tested
```sh
mjohansson@dev-qemu:~/dev/metal-cli$ METAL_CONFIG=/tmp/foo.yaml go run ./cmd/metal env
METAL_AUTH_TOKEN=foo
METAL_ORGANIZATION_ID=
METAL_PROJECT_ID=
METAL_CONFIG=/tmp/foo.yaml
mjohansson@dev-qemu:~/dev/metal-cli$ go run ./cmd/metal env --config=/tmp/foo.yaml
METAL_AUTH_TOKEN=foo
METAL_ORGANIZATION_ID=
METAL_PROJECT_ID=
METAL_CONFIG=/tmp/foo.yaml
mjohansson@dev-qemu:~/dev/metal-cli$ go run ./cmd/metal env | grep CONFIG
METAL_CONFIG=/home/mjohansson/.config/equinix/metal.yaml
```
---------
Signed-off-by: Marques Johansson <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nearly all --args can be supplied as METAL_{ARG} because we take advantage of Viper's AutomaticEnv feature.
The code that configures this and runs this happens after the config file option is detected and read in.
In order to support METAL_CONFIG, we have to check for it explicitly.
Fixes #360
How has this been tested