cfssl
cfssl copied to clipboard
CFSSL in serve mode should honour SIGHUP properly
when CFSSL is serving and you give a kill -HUP the process dies.
It's much nicer to take that signal as reloading config files, certificates & whatnot without actually dying.
func handleSIGHUP() {
// Add code here to reload configuration and certificates.
// You should replace this comment with your actual reloading logic.
// This can include reading new config files and updating the running state.
// Example:
// ReloadConfigAndCertificates()
}
func main() {
// ...
// Create a channel to receive signals
sigCh := make(chan os.Signal, 1)
// Notify the signal channel when receiving SIGHUP
signal.Notify(sigCh, syscall.SIGHUP)
// Handle signals in a separate goroutine
go func() {
for {
sig := <-sigCh
switch sig {
case syscall.SIGHUP:
handleSIGHUP()
default:
// Handle other signals as needed
}
}
}()
// ...
}