Skip to content

Commit

Permalink
stop build if config file not exist (open-telemetry#4327)
Browse files Browse the repository at this point in the history
* stop build if config file not exist

* Update cmd/builder/cmd/root.go

Co-authored-by: Bogdan Drutu <[email protected]>

Co-authored-by: Bogdan Drutu <[email protected]>
  • Loading branch information
danielqsj and Bogdan Drutu authored Nov 4, 2021
1 parent 61d3a34 commit a81ca22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/builder/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ func initConfig() {
}

// load the config file
if err := vp.ReadInConfig(); err == nil {
cfg.Logger.Info("Using config file", zap.String("path", vp.ConfigFileUsed()))
if err := vp.ReadInConfig(); err != nil {
cobra.CheckErr(err)
}
cfg.Logger.Info("Using config file", zap.String("path", vp.ConfigFileUsed()))

// convert Viper's internal state into our configuration object
if err := vp.Unmarshal(&cfg); err != nil {
Expand Down

0 comments on commit a81ca22

Please sign in to comment.