feat: Support for config file reading#55
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR starts adding configuration management support (per #49) by introducing Viper-based config/env initialization in the CLI entrypoint, along with a --config flag to point to an explicit config file.
Changes:
- Add Viper initialization and multi-location config file discovery logic in
main.go. - Add a
--configCLI flag (currently viapflag) to specify a custom config file path. - Promote
github.com/spf13/pflagto a direct dependency ingo.mod.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| main.go | Adds Viper setup, config-file discovery, and a --config flag prior to running the Cobra CLI. |
| go.mod | Adds spf13/pflag as a direct dependency to support the new flag parsing. |
Comments suppressed due to low confidence (1)
main.go:57
- Typo in comment: the listed fallback file name "$HOME/cloudclt.yaml" should be "$HOME/cloudctl.yaml".
// ./cloudctl.yaml
// $HOME/cloudclt.yaml
// $XDG_CONFIG_HOME/cloudctl/cloudctl.yaml
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ea878a5 to
5c0aec0
Compare
77e3490 to
61b0e17
Compare
onuryilmaz
reviewed
Jun 8, 2026
Add support for configuration files as described in cloudoperators#49 Signed-off-by: Piotr Skamruk <piotr.skamruk@gmail.com>
Signed-off-by: Piotr Skamruk <piotr.skamruk@gmail.com>
Signed-off-by: Piotr Skamruk <piotr.skamruk@gmail.com>
onuryilmaz
approved these changes
Jun 9, 2026
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.
Add support for configuration files as described in #49
TODO:
$HOME(by using https://pkg.go.dev/os#UserHomeDir instead of plain env variable)(* not mentioned in acceptance criteria but seems to be reasonable).