blocky/server/server_config_trigger.go

29 lines
389 B
Go
Raw Permalink Normal View History

2021-09-07 00:15:46 +02:00
//go:build !windows
// +build !windows
2020-05-24 22:42:43 +02:00
package server
import (
"context"
2020-05-24 22:42:43 +02:00
"os"
"os/signal"
"syscall"
)
func registerPrintConfigurationTrigger(ctx context.Context, s *Server) {
signals := make(chan os.Signal, 1)
2020-05-24 22:42:43 +02:00
signal.Notify(signals, syscall.SIGUSR1)
go func() {
for {
select {
case <-signals:
s.printConfiguration()
case <-ctx.Done():
return
}
2020-05-24 22:42:43 +02:00
}
}()
}