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