fix(qryptinvite): validate quota and TTL env values

This commit is contained in:
rissrice2105-agent 2026-07-15 18:28:55 -06:00
parent 24269b6799
commit ea8ac04e18
2 changed files with 50 additions and 2 deletions

View file

@ -45,12 +45,12 @@ func ConfigFromEnv() Config {
c.RedeemURL = v
}
if v := os.Getenv("AGENTBBS_QRYPT_INVITE_TTL"); v != "" {
if d, err := time.ParseDuration(v); err == nil {
if d, err := time.ParseDuration(v); err == nil && d > 0 {
c.TTL = d
}
}
if v := os.Getenv("AGENTBBS_QRYPT_INVITE_QUOTA"); v != "" {
if n, err := strconv.Atoi(v); err == nil {
if n, err := strconv.Atoi(v); err == nil && n >= 0 {
c.Quota = n
}
}