refactor: make systemctl service name configurable via agent config
This commit is contained in:
parent
4b7ca5fa82
commit
32a5913c4d
@ -14,6 +14,7 @@
|
||||
"max_upload_mb": 200,
|
||||
|
||||
"config_path": "/opt/safesight-edge-server/etc/media-server.json",
|
||||
"systemctl_service": "safesight-edge-server",
|
||||
"media_server_process": {
|
||||
"enable": true,
|
||||
"exec_path": "/opt/safesight-edge-server/bin/systemctl-wrapper.sh",
|
||||
|
||||
@ -30,6 +30,7 @@ type AgentConfig struct {
|
||||
MediaServerBaseURL string `json:"media_server_base_url"`
|
||||
MediaServerTimeout int `json:"media_server_timeout_ms"`
|
||||
MediaServerRetry RetryConfig `json:"media_server_retry"`
|
||||
SystemctlService string `json:"systemctl_service"`
|
||||
}
|
||||
|
||||
type MediaServerProcessConfig struct {
|
||||
@ -65,6 +66,7 @@ func Default() Config {
|
||||
},
|
||||
MediaServerBaseURL: "http://127.0.0.1:9000",
|
||||
MediaServerTimeout: 3000,
|
||||
SystemctlService: "safesight-edge-server",
|
||||
MediaServerRetry: RetryConfig{
|
||||
MaxAttempts: 3,
|
||||
BackoffMS: []int{200, 500},
|
||||
|
||||
@ -88,7 +88,7 @@ func New(agentCfg config.AgentConfig, baseDir string, ms *mediaserver.Client, st
|
||||
pc = procctl.New(agentCfg, baseDir)
|
||||
} else {
|
||||
// 使用 systemctl 模式管理 Media Server
|
||||
pc = procctl.NewSystemCtlController("safesight-edge-server", strings.TrimSpace(agentCfg.ConfigPath))
|
||||
pc = procctl.NewSystemCtlController(agentCfg.SystemctlService, agentCfg.ConfigPath)
|
||||
}
|
||||
execPath, _ := os.Executable()
|
||||
if execPath != "" {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user