Archived
Template
1
0

Adds a cache max age parameter and fixes cache parameter for main.js (#12)

Fixed throttling
This commit is contained in:
Markus Tenghamn
2022-01-09 12:13:09 +01:00
committed by GitHub
parent 559059f54e
commit 5d01717111
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
}