aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'internal/supervisor/systemd.go')
-rw-r--r--internal/supervisor/systemd.go24+5 −19
1 files changed, 5 insertions, 19 deletions
diff --git a/internal/supervisor/systemd.go b/internal/supervisor/systemd.go
index d95bd7f..63c1c0d 100644
--- a/internal/supervisor/systemd.go
+++ b/internal/supervisor/systemd.go
@@ -1,8 +1,6 @@
-// SPDX-FileCopyrightText: 2026 Nikolay Govorov
+// Copyright (c) 2026 Nikolay Govorov
// SPDX-License-Identifier: AGPL-3.0-or-later
-//go:build linux
-
package supervisor
import (
@@ -14,23 +12,15 @@ import (
"syscall"
"time"
- "net"
-
- "github.com/coreos/go-systemd/v22/activation"
"github.com/coreos/go-systemd/v22/daemon"
)
-func init() {
- register(func() Supervisor {
- if os.Getenv("NOTIFY_SOCKET") != "" {
- return &systemd{}
- }
- return nil
- })
-}
-
type systemd struct{}
+func detectSystemd() bool {
+ return os.Getenv("NOTIFY_SOCKET") != ""
+}
+
func (*systemd) WaitForStop(ctx context.Context) context.Context {
ctx, stop := signal.NotifyContext(ctx, syscall.SIGTERM, syscall.SIGINT)
_ = stop // stop allows you to cancel the observer, but it's not particularly useful
@@ -77,7 +67,3 @@ func (*systemd) StartWatchdog(ctx context.Context) {
}
}
}
-
-func (*systemd) ActivationListeners() (map[string][]net.Listener, error) {
- return activation.ListenersWithNames()
-}