idm: Fix error handling on startup (#3243)

* Fix idm to acutally return error during startup to the runtime
* Add proper conditon to error log statement
This commit is contained in:
Ralf Haferkamp
2022-02-28 17:52:51 +01:00
committed by GitHub
parent ba29635cd8
commit ccf6bf1b0d
+4 -4
View File
@@ -40,8 +40,7 @@ func Server(cfg *config.Config) *cli.Command {
}()
defer cancel()
start(ctx, logger, cfg)
return nil
return start(ctx, logger, cfg)
},
}
}
@@ -67,8 +66,9 @@ func start(ctx context.Context, logger log.Logger, cfg *config.Config) error {
}
if _, err := os.Stat(servercfg.BoltDBFile); errors.Is(err, os.ErrNotExist) {
logger.Debug().Msg("Bootstrapping IDM database")
err = bootstrap(logger, cfg, servercfg)
logger.Error().Err(err).Msg("failed")
if err = bootstrap(logger, cfg, servercfg); err != nil {
logger.Error().Err(err).Msg("failed to bootstrap idm database")
}
}
svc, err := server.NewServer(&servercfg)