mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 06:57:12 +01:00
add config for if github auth is enabled. room for more...
This commit is contained in:
@@ -4,6 +4,7 @@ import { mongodbAdapter } from "better-auth/adapters/mongodb"
|
||||
import { MongoClient, ServerApiVersion } from "mongodb"
|
||||
import { MONGO_URI } from "../db"
|
||||
import nodemailer from "nodemailer"
|
||||
import { getConfig } from "../helpers/config"
|
||||
|
||||
async function sendEmail({ to, subject, url }: { to: string; subject: string; url: string }) {
|
||||
const transporter = nodemailer.createTransport({
|
||||
@@ -28,7 +29,7 @@ const ADMIN_EMAIL = process.env.ADMIN_EMAIL
|
||||
const GITHUB_USERS_GRANTED = ['111471']
|
||||
const GITHUB_CLIENT_ID = process.env.GITHUB_CLIENT_ID;
|
||||
const GITHUB_CLIENT_SECRET = process.env.GITHUB_CLIENT_SECRET;
|
||||
const GITHUB_ENABLED = Boolean(GITHUB_CLIENT_SECRET?.length && GITHUB_CLIENT_ID?.length);
|
||||
const { githubAuthEnabled } = getConfig();
|
||||
|
||||
const client = new MongoClient(MONGO_URI, {
|
||||
serverApi: {
|
||||
@@ -47,7 +48,7 @@ export const auth = betterAuth({
|
||||
},
|
||||
}),
|
||||
],
|
||||
...(GITHUB_ENABLED ? {
|
||||
...(githubAuthEnabled ? {
|
||||
socialProviders: {
|
||||
github: {
|
||||
provider: 'github',
|
||||
|
||||
Reference in New Issue
Block a user