Skip to content

feat: add YAML parse check to diagnose command #107

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

Merged
merged 3 commits into from
Oct 18, 2024

Conversation

obs-gh-mattcotter
Copy link
Collaborator

@obs-gh-mattcotter obs-gh-mattcotter commented Oct 17, 2024

Description

OB-37709 add a new check to the diagnose command to check if the config file is valid YAML.

Checklist

  • Created tests which fail without the change (if possible)
  • Extended the README / documentation, if necessary

}

func checkConfig() (any, error) {
if root.CfgFile == "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

where does this get set? would viper.ConfigFileUsed() be a better fit here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This gets set by Cobra here:

RootCmd.PersistentFlags().StringVar(&CfgFile, "config", "", "config file path")

But you're right, we have custom handling to find the default file in Viper if that's not set. I updated to viper.ConfigFileUsed(), good catch!

Base automatically changed from mattc/OB-37709 to main October 18, 2024 16:52
@obs-gh-mattcotter obs-gh-mattcotter merged commit e2dab7a into main Oct 18, 2024
8 checks passed
@obs-gh-mattcotter obs-gh-mattcotter deleted the OB-37709-yaml-check branch October 18, 2024 20:35
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.

2 participants