cmd/cli: add DNS as ctrld service dependency

So on Windows system where there's local DNS running, ctrld could set
DNS forwarders correctly after DNS service started.
This commit is contained in:
Cuong Manh Le
2025-02-25 19:45:45 +07:00
committed by Cuong Manh Le
parent e68bfa795a
commit 6ab3ab9faf
2 changed files with 15 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
//go:build !linux && !freebsd && !darwin
//go:build !linux && !freebsd && !darwin && !windows
package cli

14
cmd/cli/prog_windows.go Normal file
View File

@@ -0,0 +1,14 @@
package cli
import "github.com/kardianos/service"
func setDependencies(svc *service.Config) {
if hasLocalDnsServerRunning() {
svc.Dependencies = []string{"DNS"}
}
}
func setWorkingDirectory(svc *service.Config, dir string) {
// WorkingDirectory is not supported on Windows.
svc.WorkingDirectory = dir
}