Commit 480f8a23 authored by Grant's avatar Grant
Browse files

move auth to env

parent 45fd93ef
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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);
+15 −0
Original line number Diff line number Diff line
@@ -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();
+4 −0
Original line number Diff line number Diff line
@@ -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;
    }
  }
}