add ctx to hook, handle hook errors

Signed-off-by: Brian Downs <brian.downs@gmail.com>
This commit is contained in:
Brian Downs
2020-08-19 16:54:58 -07:00
parent fa2c1422b3
commit 324bb55986
3 changed files with 9 additions and 3 deletions

View File

@@ -61,7 +61,9 @@ func StartServer(ctx context.Context, config *Config) error {
}
for _, hook := range config.StartupHooks {
hook(config.ControlConfig)
if err := hook(ctx, config.ControlConfig); err != nil {
return errors.Wrap(err, "startup hook")
}
}
ip := net2.ParseIP(config.ControlConfig.BindAddress)