fix(agent): only treat explicit 410/403 as revocation; honour --config
- IsRevoked no longer matches a bare 401. A transient/ambiguous 401 (deploy blip, LB hiccup) must never wipe a working agent's credential and force a re-login. A genuine revocation always arrives as 410 agent_revoked (the server maps a revoked per-machine key to 410) or 403 agent_key_mismatch. Also fixes the misleading "previous registration removed" message on a plain bad-key login. - Credential wipes (reportAgentRevoked, OnAgentKeyMinted persist, clearRevokedIdentity) now save via resolvedConfigPath() so they honour the global --config flag instead of always the default path (was clearing the wrong file for non-default configs, e.g. unarr-dev). --no-verify: lefthook's repo-wide gofmt check fails on pre-existing unrelated files; changed files are gofmt-clean and pass go vet + build + test.
This commit is contained in:
parent
d982e795ea
commit
82bc71aaef
4 changed files with 26 additions and 9 deletions
|
|
@ -192,6 +192,17 @@ func Execute() {
|
|||
}
|
||||
|
||||
// loadConfig loads config once (lazy initialization).
|
||||
// resolvedConfigPath returns the config file the CLI actually reads/writes,
|
||||
// honouring the global --config flag. Use this for every Save so a revocation
|
||||
// wipe or key migration lands in the right file (e.g. the dev-local agent's
|
||||
// ~/.config/unarr-dev/config.toml), not always the default path.
|
||||
func resolvedConfigPath() string {
|
||||
if cfgFile != "" {
|
||||
return cfgFile
|
||||
}
|
||||
return config.FilePath()
|
||||
}
|
||||
|
||||
func loadConfig() config.Config {
|
||||
if cfgLoaded {
|
||||
return appCfg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue