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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to $XDG_CONFIG_PATH/minder/config.yaml when reading configuration #3645

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Jun 18, 2024

Summary

This allows us to have a predictable configuration file when reading the
client minder configuration. The idea is that we could set up
$XDG_CONFIG_PATH/minder/config.yaml and that would serve as an entrypoint.

In the future, we could modify this if we want to dynamically change
the current working project.

Change Type

Mark the type of change your PR introduces:

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

@JAORMX JAORMX requested a review from a team as a code owner June 18, 2024 07:28
@JAORMX JAORMX requested a review from rdimitrov June 18, 2024 07:28
@coveralls
Copy link

Coverage Status

coverage: 53.392% (+0.002%) from 53.39%
when pulling 7a4a9a5 on config-homedir
into 31e0ca3 on main.

@coveralls
Copy link

Coverage Status

coverage: 53.397% (+0.007%) from 53.39%
when pulling f27d63c on config-homedir
into 31e0ca3 on main.

cmd/cli/app/root.go Outdated Show resolved Hide resolved
…guration

This allows us to have a predictable configuration file when reading the
client minder configuration. The idea is that we could set up
`$XDG_CONFIG_PATH/minder/config.yaml` and that would serve as an entrypoint.

In the future, we could modify this if we want to dynamically change
the current working project.

Signed-off-by: Juan Antonio Osorio <ozz@stacklok.com>
@JAORMX JAORMX changed the title Fall back to $HOME/.minder.yaml when reading configuration Fall back to $XDG_CONFIG_PATH/minder/config.yaml when reading configuration Jun 18, 2024
@coveralls
Copy link

Coverage Status

coverage: 53.313% (+0.02%) from 53.296%
when pulling eefe6a7 on config-homedir
into 67208c5 on main.

@@ -73,7 +74,7 @@ Configuration options include:
- identity.cli.issuer_url
- identity.cli.client_id

By default, we look for the file as $PWD/config.yaml. You can specify a custom path via the --config flag, or by setting the MINDER_CONFIG environment variable.`,
By default, we look for the file as $PWD/config.yaml and $XDG_CONFIG_PATH/minder/config.yaml. You can specify a custom path via the --config flag, or by setting the MINDER_CONFIG environment variable.`,
Copy link
Member

Choose a reason for hiding this comment

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

How does this work if both are present? Is it that one gets a preference over the other or it's something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

one gets preference. First $PWD/config.yaml, then the other one.

Copy link
Member

@rdimitrov rdimitrov Jun 18, 2024

Choose a reason for hiding this comment

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

Got it, I was afraid we can accidentally get in a state of conflict if there are two config files present 👍

@JAORMX JAORMX requested review from rdimitrov, dmjb and blkt June 18, 2024 11:54
@JAORMX JAORMX merged commit 30a1884 into main Jun 18, 2024
23 checks passed
@JAORMX JAORMX deleted the config-homedir branch June 18, 2024 12:18
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.

None yet

5 participants