Skip to content

best way to save what you love

change cookie path capitalization for consistency with other env stuff

wukkoc72d9b0ed15d
diff --git a/docker-compose.example.yml b/docker-compose.example.yml
index 20cf43c6..bd7d9157 100644
--- a/docker-compose.example.yml
+++ b/docker-compose.example.yml
@@ -20,7 +20,9 @@ services:
- apiURL=https://co.wuk.sh/
# replace apiName with your instance's distinctive name
- apiName=eu-nl
-
+ # if you want to use cookies when fetching data from services, uncomment the next line
+ #- cookiePath=/cookies.json
+ # see src/modules/processing/cookie/cookies_example.json for example file.
cobalt-web:
build: .
diff --git a/src/modules/processing/cookie/manager.js b/src/modules/processing/cookie/manager.js
index 2e585b12..437100a0 100644
--- a/src/modules/processing/cookie/manager.js
+++ b/src/modules/processing/cookie/manager.js
@@ -3,16 +3,16 @@ import { readFile, writeFile } from 'fs/promises';
import { parse as parseSetCookie, splitCookiesString } from 'set-cookie-parser';
const WRITE_INTERVAL = 60000,
- COOKIE_PATH = process.env.COOKIE_PATH,
+ cookiePath = process.env.cookiePath,
COUNTER = Symbol('counter');
let cookies = {}, dirty = false, intervalId;
const setup = async () => {
try {
- if (!COOKIE_PATH) return;
+ if (!cookiePath) return;
- cookies = await readFile(COOKIE_PATH, 'utf8');
+ cookies = await readFile(cookiePath, 'utf8');
cookies = JSON.parse(cookies);
intervalId = setInterval(writeChanges, WRITE_INTERVAL)
} catch { /* no cookies for you */ }
@@ -24,7 +24,7 @@ function writeChanges() {
if (!dirty) return;
dirty = false;
- writeFile(COOKIE_PATH, JSON.stringify(cookies, null, 4)).catch(() => {
+ writeFile(cookiePath, JSON.stringify(cookies, null, 4)).catch(() => {
clearInterval(intervalId)
})
}