mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-08-13 14:27:27 +00:00
fix(qryptinvite): validate quota and TTL env values (#93)
Co-authored-by: rissrice2105-agent <rissrice2105-agent@users.noreply.github.com>
This commit is contained in:
parent
db641c79bb
commit
7cb2aba24e
2 changed files with 50 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue