feat(config): add restart options for unit configuration

* include Restart, RestartSec, and RestartRetries fields
* update service file generation to support restart settings
* add tests for restart behavior in unit generation
This commit is contained in:
Hein
2026-04-10 09:38:45 +02:00
parent a273232303
commit b58373ad2f
3 changed files with 63 additions and 3 deletions

View File

@@ -20,6 +20,9 @@ type Unit struct {
Delay string `yaml:"delay,omitempty"` // e.g. "5s"
Enabled bool `yaml:"enabled"`
DisabledReason string `yaml:"disabled_reason,omitempty"`
Restart bool `yaml:"restart,omitempty"` // enable Restart=on-failure
RestartSec int `yaml:"restart_sec,omitempty"` // seconds between restarts
RestartRetries int `yaml:"restart_retries,omitempty"` // max restart attempts (StartLimitBurst)
}
// Config is the root config structure.