1
0
Fork 0

Support systemd socket-activation

Co-authored-by: Michael <michael.matur@gmail.com>
This commit is contained in:
Julien Salleyron 2024-06-25 16:30:04 +02:00 committed by GitHub
parent 9e0800f938
commit b7de043991
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 91 additions and 20 deletions

View file

@ -0,0 +1,24 @@
//go:build !windows
package server
import (
"net"
"github.com/coreos/go-systemd/activation"
"github.com/rs/zerolog/log"
)
func populateSocketActivationListeners() {
listenersWithName, _ := activation.ListenersWithNames()
socketActivationListeners = make(map[string]net.Listener)
for name, lns := range listenersWithName {
if len(lns) != 1 {
log.Error().Str("listenersName", name).Msg("Socket activation listeners must have one and only one listener per name")
continue
}
socketActivationListeners[name] = lns[0]
}
}