Archived
Template
1
0

Adds a cache max age parameter and fixes cache parameter for main.js

Fixed throttling
This commit is contained in:
uberswe
2022-01-09 12:11:54 +01:00
parent 559059f54e
commit 3f3b2338d6
7 changed files with 26 additions and 16 deletions

11
env.go
View File

@ -77,5 +77,16 @@ func loadEnvVariables() (c config.Config) {
if os.Getenv("CACHE_PARAMETER") != "" {
c.CacheParameter = os.Getenv("CACHE_PARAMETER")
}
// CacheMaxAge is how many seconds to cache static assets
c.CacheMaxAge = 31536000
if os.Getenv("CACHE_MAX_AGE") != "" {
i, err := strconv.Atoi(os.Getenv("CACHE_MAX_AGE"))
if err != nil {
log.Fatalln(err)
return
}
c.CacheMaxAge = i
}
return c
}