config: default agent.asset_dir so old configs still serve /assets
CI / Lint + build + test (push) Failing after 5m12s
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:
@@ -3,6 +3,7 @@ package config
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
@@ -125,5 +126,13 @@ func Load(path string) (*Config, error) {
|
|||||||
if c.Dispatcher.MaxConcurrentRuns == 0 {
|
if c.Dispatcher.MaxConcurrentRuns == 0 {
|
||||||
c.Dispatcher.MaxConcurrentRuns = 3
|
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
|
return &c, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user