Skip to content

feat: Support for config file reading#55

Merged
onuryilmaz merged 3 commits into
cloudoperators:mainfrom
jellonek:viper
Jun 9, 2026
Merged

feat: Support for config file reading#55
onuryilmaz merged 3 commits into
cloudoperators:mainfrom
jellonek:viper

Conversation

@jellonek

@jellonek jellonek commented May 21, 2026

Copy link
Copy Markdown
Contributor

Add support for configuration files as described in #49

TODO:

  • update README.md
  • remove assumption for correct value of $HOME (by using https://pkg.go.dev/os#UserHomeDir instead of plain env variable)
  • * add test coverage
    (* not mentioned in acceptance criteria but seems to be reasonable).

Copilot AI review requested due to automatic review settings May 21, 2026 15:18
@jellonek jellonek requested review from a team as code owners May 21, 2026 15:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 --config CLI flag (currently via pflag) to specify a custom config file path.
  • Promote github.com/spf13/pflag to a direct dependency in go.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.

Comment thread main.go Outdated
Comment thread main.go Outdated
Comment thread main.go Outdated
Comment thread main.go Outdated
Comment thread main.go Outdated
Comment thread main.go Outdated
Comment thread main.go Outdated
Comment thread main.go Outdated
@jellonek jellonek force-pushed the viper branch 4 times, most recently from ea878a5 to 5c0aec0 Compare May 28, 2026 13:36
@jellonek jellonek force-pushed the viper branch 2 times, most recently from 77e3490 to 61b0e17 Compare June 8, 2026 09:39
@jellonek jellonek changed the title [WIP] feat: Support for config file reading feat: Support for config file reading Jun 8, 2026

@onuryilmaz onuryilmaz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left a few small notes below, mostly docs alignment and one clarifying comment request. Nothing blocking.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread cmd/root.go
Comment thread cmd/root.go
Comment thread cmd/cluster-version.go
Comment thread cmd/version.go
jellonek added 2 commits June 9, 2026 10:18
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 onuryilmaz merged commit 8d43fc8 into cloudoperators:main Jun 9, 2026
6 checks passed
@jellonek jellonek deleted the viper branch June 10, 2026 10:08
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.

3 participants