HH-682: add validated candidate config pipeline
Docker image / Test (pull_request) Canceled after 0s
Docker image / Build and publish (pull_request) Canceled after 0s

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-08-26 11:30:04 +08:00
co-authored by multica-agent
parent 5b14158870
commit 2363afba9b
7 changed files with 607 additions and 1 deletions
+19
View File
@@ -20,10 +20,29 @@ const (
defaultConfigSource = "/usr/local/share/ssclash/config.yaml"
ssclashBinary = "/usr/local/bin/ssclash"
defaultRuntimeDir = "/dev/shm/mohomo"
defaultSecretPath = "/run/secrets/subscription"
defaultDataDir = "/data"
)
func main() {
log.SetFlags(log.Ldate | log.Ltime | log.LUTC)
if len(os.Args) == 2 && os.Args[1] == "candidate" {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
if err := bootstrap.PublishCandidate(ctx, bootstrap.CandidateConfig{
SecretPath: defaultSecretPath,
DataDir: defaultDataDir,
TemplatePath: defaultConfigSource,
MihomoBinary: defaultCoreSource,
}); err != nil {
log.Fatalf("bootstrap: candidate update failed: %v", err)
}
log.Print("bootstrap: candidate configuration published")
return
}
if len(os.Args) != 1 {
log.Fatal("bootstrap: usage: bootstrap [candidate]")
}
root := envOrDefault("SSCLASH_ROOT", defaultRoot)
log.Printf("bootstrap: preparing persistent runtime root=%s", root)