Support systemd socket-activation
Co-authored-by: Michael <michael.matur@gmail.com>
This commit is contained in:
parent
9e0800f938
commit
b7de043991
6 changed files with 91 additions and 20 deletions
24
pkg/server/socket_activation_unix.go
Normal file
24
pkg/server/socket_activation_unix.go
Normal 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]
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue