move auth to env

This commit is contained in:
Grant 2024-03-13 13:21:29 -06:00
parent 45fd93ef48
commit 480f8a2375
3 changed files with 20 additions and 3 deletions

View File

@ -3,9 +3,7 @@ import { prisma } from "./lib/prisma";
const app = Router();
const AUTH_ENDPOINT = "https://auth.fediverse.events";
const AUTH_CLIENT = "canvas";
const AUTH_SECRET = "secret";
const { AUTH_ENDPOINT, AUTH_CLIENT, AUTH_SECRET } = process.env;
app.get("/me", (req, res) => {
res.json(req.session);

View File

@ -36,6 +36,21 @@ if (!process.env.REDIS_SESSION_PREFIX) {
);
}
if (!process.env.AUTH_ENDPOINT) {
Logger.error("AUTH_ENDPOINT is not defined");
process.exit(1);
}
if (!process.env.AUTH_CLIENT) {
Logger.error("AUTH_CLIENT is not defined");
process.exit(1);
}
if (!process.env.AUTH_SECRET) {
Logger.error("AUTH_SECRET is not defined");
process.exit(1);
}
Redis.connect();
const express = new ExpressServer();

View File

@ -40,6 +40,10 @@ declare global {
* If set, use this relative path to serve the admin UI at /admin
*/
SERVE_ADMIN?: string;
AUTH_ENDPOINT: string;
AUTH_CLIENT: string;
AUTH_SECRET: string;
}
}
}