fix(license): degrade to free when servers unreachable or key rejected
On startup, if the license server was unreachable with no usable cached status, or the server rejected the key, we only logged a warning without clearing persisted license.state. On Redis/keyvalue deployments a previous run's Licensed=true could remain active even though pro features were advertised as unavailable. Route both paths through degradeToFree so the persisted state is cleared.
This commit is contained in:
parent
c8893f4533
commit
73a0f691ec
|
|
@ -180,10 +180,13 @@ func Init() {
|
|||
log.Fatalf("Could not apply cached license: %s", err)
|
||||
}
|
||||
} else {
|
||||
log.Warningf("Could not reach any license server and no cached validation exists. Pro features will not be available. Please check your network connectivity.")
|
||||
// Clear any persisted Licensed=true state from a previous run
|
||||
// (e.g. via Redis keyvalue) so a now-unreachable server can't
|
||||
// leave stale entitlements active.
|
||||
degradeToFree("Could not reach any license server and no cached validation exists. Pro features will not be available.")
|
||||
}
|
||||
case !resp.Valid:
|
||||
log.Warningf("License key is invalid: %s. Pro features will not be available.", resp.Message)
|
||||
degradeToFree(fmt.Sprintf("License key is invalid: %s.", resp.Message))
|
||||
default:
|
||||
applyResponse(resp)
|
||||
if err := cacheResponse(resp); err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue