Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "./loadEnv.ts";

import { createServer } from "node:http";

import express from "express";
Expand Down
13 changes: 13 additions & 0 deletions apps/server/src/loadEnv.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import path from "node:path";
import { fileURLToPath } from "node:url";

const ROOT = path.resolve(
path.dirname(fileURLToPath(import.meta.url)),
"../../..",
);

try {
process.loadEnvFile(path.join(ROOT, ".env"));
} catch {
// No .env file present — fine, values may come from the real environment.
}
3 changes: 2 additions & 1 deletion scripts/oktassoAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const DEFAULT_REFRESH_AFTER_MS = Number(env("OKTASSO_REFRESH_AFTER_MS"));

const CACHE_DIR = path.join(os.homedir(), ".cache", "tangle-deploy");
const CACHE_FILE = path.join(CACHE_DIR, "oktasso_token.json");
const OKTASSO_TOKEN_NAME = env("AUTH_JWT_TOKEN_COOKIE_NAME");

export interface OktassoHeaders {
cookie: string;
Expand Down Expand Up @@ -143,7 +144,7 @@ async function runAuthFlow(
);
const expiry = new Date(Date.now() + 24 * 60 * 60 * 1000);
return {
cookie: `OKTASSO_TOKEN=${oktassoToken}`,
cookie: `${OKTASSO_TOKEN_NAME}=${oktassoToken}`,
expiry: formatExpiry(expiry),
};
}
Expand Down
Loading