Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,15 @@ func initConfig() {
viper.AddConfigPath(home + "/.config/equinix")
viper.SetConfigType("yaml")
viper.SetConfigName("equinix")

err = viper.MergeInConfig()
cobra.CheckErr(err)
// If the config file doesn't exist, ignore it. There are
// other ways to configure the CLI, such as env vars, so
// we don't have to force the existence of a config file
if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
// Another error occurred while reading the config file; handle it as a fatal error
cobra.CheckErr(err)
}

// Read Metal auth token from metal CLI config if it
// wasn't set in env or equinix config
Expand Down