@opencode-cloud/core 14.0.0 → 15.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +1 -1
- package/package.json +1 -1
- package/src/platform/systemd.rs +13 -1
package/Cargo.toml
CHANGED
package/package.json
CHANGED
package/src/platform/systemd.rs
CHANGED
|
@@ -68,6 +68,17 @@ impl SystemdManager {
|
|
|
68
68
|
// This gives enough window for the allowed burst of restarts
|
|
69
69
|
let start_limit_interval = config.restart_delay * config.restart_retries * 2;
|
|
70
70
|
|
|
71
|
+
let service_user_line = if !self.user_mode {
|
|
72
|
+
std::env::var("OPENCODE_SERVICE_USER")
|
|
73
|
+
.ok()
|
|
74
|
+
.map(|value| value.trim().to_string())
|
|
75
|
+
.filter(|value| !value.is_empty())
|
|
76
|
+
.map(|value| format!("User={value}\n"))
|
|
77
|
+
.unwrap_or_default()
|
|
78
|
+
} else {
|
|
79
|
+
String::new()
|
|
80
|
+
};
|
|
81
|
+
|
|
71
82
|
format!(
|
|
72
83
|
r#"[Unit]
|
|
73
84
|
Description=opencode-cloud container service
|
|
@@ -77,7 +88,7 @@ Requires=docker.service
|
|
|
77
88
|
|
|
78
89
|
[Service]
|
|
79
90
|
Type=simple
|
|
80
|
-
ExecStart={exec_start}
|
|
91
|
+
{service_user_line}ExecStart={exec_start}
|
|
81
92
|
ExecStop={exec_stop}
|
|
82
93
|
Restart=on-failure
|
|
83
94
|
RestartSec={restart_delay}s
|
|
@@ -92,6 +103,7 @@ WantedBy=default.target
|
|
|
92
103
|
restart_delay = config.restart_delay,
|
|
93
104
|
restart_retries = config.restart_retries,
|
|
94
105
|
start_limit_interval = start_limit_interval,
|
|
106
|
+
service_user_line = service_user_line,
|
|
95
107
|
)
|
|
96
108
|
}
|
|
97
109
|
|