Skip to content

Commit

Permalink
Fail fast when config is not set (open-telemetry#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
songy23 authored and Paulo Janotti committed Jul 30, 2019
1 parent 5f88de9 commit e87131c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ func New(
}

func (app *Application) init() {
var err error
if file := builder.GetConfigFile(app.v); file != "" {
app.v.SetConfigFile(file)
err := app.v.ReadInConfig()
if err != nil {
log.Fatalf("Error loading config file %q: %v", file, err)
return
}
file := builder.GetConfigFile(app.v)
if file == "" {
log.Fatalf("Config file not specified")
}
app.v.SetConfigFile(file)
err := app.v.ReadInConfig()
if err != nil {
log.Fatalf("Error loading config file %q: %v", file, err)
}
app.logger, err = newLogger(app.v)
if err != nil {
Expand Down

0 comments on commit e87131c

Please sign in to comment.