feat: add CACHE_SECONDS environment variable (#2266)

* feat: add CACHE_SECONDS environment variable

This commit adds the CACHE_SECONDS environment variable. This variable
can be used to circumvent our cache clamping values for self hosted
Vercel instances.

* refactor: apply formatter
This commit is contained in:
Rick Staa authored and GitHub committed 2023-06-09 04:44:42 +03:00
1 parent 38c8a7a1e4
commit 3e66189c44
5 files changed
+59 -19

No files matched your search

+4 -1
View File
@@ -62,11 +62,14 @@ export default async (req, res) => {
count_weight,
);
const cacheSeconds = clampValue(
let cacheSeconds = clampValue(
parseInt(cache_seconds || CONSTANTS.FOUR_HOURS, 10),
CONSTANTS.FOUR_HOURS,
CONSTANTS.ONE_DAY,
);
cacheSeconds = process.env.CACHE_SECONDS
? parseInt(process.env.CACHE_SECONDS, 10) || cacheSeconds
: cacheSeconds;
res.setHeader(
"Cache-Control",