diff --git a/edge-ai-platform/installer/app.go b/edge-ai-platform/installer/app.go
index 84e6f44..10474ff 100644
--- a/edge-ai-platform/installer/app.go
+++ b/edge-ai-platform/installer/app.go
@@ -347,7 +347,7 @@ func (inst *Installer) stepAutoRestart(config InstallConfig) error {
Message: "Registering auto-restart service...",
Percent: 96,
})
- return installAutoRestart(config.InstallDir)
+ return installAutoRestart(config)
}
// extractFile copies a single file from the embedded payload to disk.
diff --git a/edge-ai-platform/installer/platform_darwin.go b/edge-ai-platform/installer/platform_darwin.go
index 23ecb03..22beeb1 100644
--- a/edge-ai-platform/installer/platform_darwin.go
+++ b/edge-ai-platform/installer/platform_darwin.go
@@ -107,7 +107,8 @@ func removeQuarantine(installDir string) {
exec.Command("xattr", "-dr", "com.apple.quarantine", binPath).Run()
}
-func installAutoRestart(installDir string) error {
+func installAutoRestart(config InstallConfig) error {
+ installDir := config.InstallDir
home, err := os.UserHomeDir()
if err != nil {
return fmt.Errorf("cannot determine home directory: %w", err)
@@ -122,6 +123,24 @@ func installAutoRestart(installDir string) error {
binPath := filepath.Join(installDir, "edge-ai-server")
+ // Build ProgramArguments with relay args if configured
+ progArgs := []string{
+ ` ` + binPath + ``,
+ ` --tray`,
+ }
+ if config.RelayURL != "" {
+ progArgs = append(progArgs,
+ ` --relay-url`,
+ ` `+config.RelayURL+``,
+ )
+ }
+ if config.RelayToken != "" {
+ progArgs = append(progArgs,
+ ` --relay-token`,
+ ` `+config.RelayToken+``,
+ )
+ }
+
plist := strings.Join([]string{
``,
``,
@@ -131,8 +150,7 @@ func installAutoRestart(installDir string) error {
` ` + launchdLabel + ``,
` ProgramArguments`,
` `,
- ` ` + binPath + ``,
- ` --tray`,
+ strings.Join(progArgs, "\n"),
` `,
` EnvironmentVariables`,
` `,
diff --git a/edge-ai-platform/installer/platform_linux.go b/edge-ai-platform/installer/platform_linux.go
index 19280d8..f486301 100644
--- a/edge-ai-platform/installer/platform_linux.go
+++ b/edge-ai-platform/installer/platform_linux.go
@@ -63,7 +63,8 @@ func removeQuarantine(installDir string) {
// No-op on Linux
}
-func installAutoRestart(installDir string) error {
+func installAutoRestart(config InstallConfig) error {
+ installDir := config.InstallDir
home, err := os.UserHomeDir()
if err != nil {
return fmt.Errorf("cannot determine home directory: %w", err)
@@ -78,6 +79,15 @@ func installAutoRestart(installDir string) error {
binPath := filepath.Join(installDir, "edge-ai-server")
+ // Build ExecStart with relay args if configured
+ execStart := binPath
+ if config.RelayURL != "" {
+ execStart += " --relay-url " + config.RelayURL
+ }
+ if config.RelayToken != "" {
+ execStart += " --relay-token " + config.RelayToken
+ }
+
service := strings.Join([]string{
"[Unit]",
"Description=Edge AI Platform Server",
@@ -85,7 +95,7 @@ func installAutoRestart(installDir string) error {
"",
"[Service]",
"Type=simple",
- "ExecStart=" + binPath,
+ "ExecStart=" + execStart,
"WorkingDirectory=" + installDir,
"Restart=on-failure",
"RestartSec=5",
diff --git a/edge-ai-platform/installer/platform_windows.go b/edge-ai-platform/installer/platform_windows.go
index 6ccae19..ed498a1 100644
--- a/edge-ai-platform/installer/platform_windows.go
+++ b/edge-ai-platform/installer/platform_windows.go
@@ -205,9 +205,21 @@ func removeQuarantine(installDir string) {
// No-op on Windows
}
-func installAutoRestart(installDir string) error {
+func installAutoRestart(config InstallConfig) error {
+ installDir := config.InstallDir
binPath := filepath.Join(installDir, "edge-ai-server.exe")
+
+ // Build command with relay args if configured
regValue := fmt.Sprintf(`"%s" --gui`, binPath)
+ startArgs := []string{"--gui"}
+ if config.RelayURL != "" {
+ regValue += fmt.Sprintf(` --relay-url "%s"`, config.RelayURL)
+ startArgs = append(startArgs, "--relay-url", config.RelayURL)
+ }
+ if config.RelayToken != "" {
+ regValue += fmt.Sprintf(` --relay-token "%s"`, config.RelayToken)
+ startArgs = append(startArgs, "--relay-token", config.RelayToken)
+ }
// Use Registry Run key for auto-start (no admin required, works on all Windows locales)
cmd := exec.Command("reg", "add",
@@ -225,7 +237,7 @@ func installAutoRestart(installDir string) error {
exec.Command("schtasks", "/Delete", "/TN", "EdgeAIPlatformServer", "/F").Run()
// Start the server immediately
- startCmd := exec.Command(binPath, "--gui")
+ startCmd := exec.Command(binPath, startArgs...)
startCmd.Dir = installDir
startCmd.Start()