mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-08-18 04:27:16 +00:00
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:
+4
-1
@@ -55,11 +55,14 @@ export default async (req, res) => {
|
||||
parseArray(exclude_repo),
|
||||
);
|
||||
|
||||
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",
|
||||
|
||||
Reference in New Issue
Block a user