add CACHE_DIR envvar

This commit is contained in:
Jill 2024-02-16 16:54:35 +03:00
parent 9041ad0050
commit 926102bd70
Signed by: oat
GPG Key ID: 33489AA58A955108
2 changed files with 3 additions and 2 deletions

View File

@ -90,4 +90,5 @@ You can self-host the API yourself, if you so wish! Here's the rough steps:
You can pass these into the server as config (an `.env` file will **not** work):
- `API_KEY`: A Google API key - see [this guide](https://theoephraim.github.io/node-google-spreadsheet/#/guides/authentication?id=api-key) to see how to get one hassle-free
- `PORT`: The HTTP port to host the server on
- `PORT`: The HTTP port to host the server on
- `CACHE_DIR`: The directory to store cached data in, defaults to `./cache/`

View File

@ -6,7 +6,7 @@ import path from 'path';
import { request } from 'undici';
import PQueue from 'p-queue';
const cacheFolder = './cache/';
const cacheFolder = process.env.CACHE_DIR || './cache/';
let levels = {
nlw: {