INNER CODE UNIT · Go
listenForInterrupts
kuberhealthy/kuberhealthy · cmd/kuberhealthy/main.go:133
func listenForInterrupts(ctx context.Context, interruptChan chan struct{}) {
// register for shutdown events on sigChan
ctx, ctxCancel := signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM)
defer ctxCancel()
log.Infoln("Shutdown waiting for sigChan notification...")
<-ctx.Done() // wait for signal to occur
interruptChan <- struct{}{} // notify that we got a signal
}
// initConfig loads and sets default Kuberhealthy configurations
// Everytime kuberhealthy sees a configuration change, configurations should reload and reset
func initConfig() error {
GlobalConfig = New()
err := GlobalConfig.LoadFromEnv()
if err != nil {