[#12] Add lazy-expiry to mem-storage, unify envvars

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-01-24 16:33:14 +01:00
parent 1a91a5d34d
commit 990fddff7a
No known key found for this signature in database
GPG key ID: DC2729FDD34BE99E
3 changed files with 51 additions and 12 deletions

View file

@ -65,12 +65,19 @@ func (s storageRedis) migrate() error {
}
func (s storageRedis) redisExpiry() int {
exp := os.Getenv("REDIS_EXPIRY")
if exp == "" {
var expStr string
for _, eVar := range []string{"SECRET_EXPIRY", "REDIS_EXPIRY"} {
if v := os.Getenv(eVar); v != "" {
expStr = v
break
}
}
if expStr == "" {
return 0
}
e, err := strconv.ParseInt(exp, 10, 64)
e, err := strconv.ParseInt(expStr, 10, 64)
if err != nil {
return 0
}