Harden production workflows and agent admission
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user