Harden production workflows and agent admission

This commit is contained in:
Stanislav Rossovskii
2026-05-28 14:19:27 +04:00
parent a2e88b4e76
commit 37b1a1d6d6
109 changed files with 4927 additions and 894 deletions

View File

@@ -9,6 +9,7 @@ import (
"path/filepath"
"syscall"
"github.com/monlet/agent/internal/agentkey"
"github.com/monlet/agent/internal/app"
"github.com/monlet/agent/internal/client"
"github.com/monlet/agent/internal/config"
@@ -43,11 +44,20 @@ func main() {
os.Exit(1)
}
key := ""
if cfg.PushesToServer() {
key, err = agentkey.LoadOrCreate(cfg.StateDir)
if err != nil {
log.Error("agent key", "err", err)
os.Exit(1)
}
}
a := &app.App{
Cfg: cfg,
AgentID: agentID,
Version: version,
Client: client.New(cfg.Server.URL, cfg.Server.Token, agentID),
Client: client.New(cfg.Server.URL, key, agentID),
Spool: sp,
Metrics: metrics.New(),
Log: log,