mirror of
https://github.com/rybbit-io/rybbit.git
synced 2025-05-10 20:05:38 +02:00
fix allowlist
This commit is contained in:
parent
5bee6d3e5a
commit
05292f9ebb
2 changed files with 14 additions and 24 deletions
|
@ -1,8 +1,7 @@
|
|||
import { betterAuth } from "better-auth";
|
||||
import pg from "pg";
|
||||
import { username } from "better-auth/plugins";
|
||||
import dotenv from "dotenv";
|
||||
import { sql } from "../db/postgres/postgres.js";
|
||||
import pg from "pg";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
|
@ -10,9 +9,7 @@ type AuthType = ReturnType<typeof betterAuth> | null;
|
|||
|
||||
export let auth: AuthType | null = null;
|
||||
|
||||
export const initAuth = async () => {
|
||||
const domains = await sql`SELECT domain FROM sites`;
|
||||
console.info(domains);
|
||||
export const initAuth = (allowList: string[]) => {
|
||||
auth = betterAuth({
|
||||
basePath: "/auth",
|
||||
database: new pg.Pool({
|
||||
|
@ -26,11 +23,6 @@ export const initAuth = async () => {
|
|||
enabled: true,
|
||||
},
|
||||
plugins: [username()],
|
||||
trustedOrigins: [
|
||||
"http://localhost:3002",
|
||||
"http://localhost:3001",
|
||||
"https://tracking.tomato.gg",
|
||||
...domains.map(({ domain }) => `https://${domain}`),
|
||||
],
|
||||
trustedOrigins: allowList,
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue