Prevent a warning being printed when parsing config#62
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR prevents Viper’s config auto-discovery from matching an extensionless file named bagel (notably the ./bagel binary when running from its directory), which previously caused YAML parse warnings/errors during config loading.
Changes:
- Stop calling
SetConfigType("yaml")during config auto-discovery so onlybagel.<ext>files are considered. - Add a regression test intended to ensure the extensionless
bagelbinary is not parsed as config. - Mirror the same “no SetConfigType” behavior in CLI startup config initialization.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/config/config.go | Removes SetConfigType during auto-discovery to avoid matching an extensionless bagel file (the binary). |
| pkg/config/config_test.go | Adds a regression test for the extensionless-binary matching scenario (currently needs adjustment to assert on the real log message). |
| cmd/bagel/root.go | Removes SetConfigType from CLI initConfig auto-discovery path and documents rationale. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fproulx-boostsecurity
approved these changes
Jun 19, 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.
Added after the #60 fix so we don't see a warning when it tries to parse the binary itself as a config file