config: default agent.asset_dir so old configs still serve /assets
CI / Lint + build + test (push) Failing after 5m12s

Operators who installed vetting before agent.asset_dir existed keep
their config preserved by install.sh on upgrade, which left them
with AssetDir="" — the router silently dropped the /assets/*
mount and the quick-register one-liner hit 404 fetching the agent
binary. Default AssetDir alongside the database file so the same
directory install.sh already creates + drops the agent binary into
is picked up automatically.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-18 00:41:09 -04:00
parent 1694c20b12
commit c9927ca2bf
+9
View File
@@ -3,6 +3,7 @@ package config
import (
"fmt"
"os"
"path/filepath"
"gopkg.in/yaml.v3"
)
@@ -125,5 +126,13 @@ func Load(path string) (*Config, error) {
if c.Dispatcher.MaxConcurrentRuns == 0 {
c.Dispatcher.MaxConcurrentRuns = 3
}
// Default the agent asset dir alongside the database file so upgrades
// from configs predating the agent.asset_dir field pick up a sensible
// location automatically — install.sh creates exactly this directory
// and drops vetting-agent-linux-amd64 into it, so /assets/* serves
// without the operator having to touch vetting.yaml.
if c.Agent.AssetDir == "" {
c.Agent.AssetDir = filepath.Join(filepath.Dir(c.Database.Path), "assets")
}
return &c, nil
}