blob: 4fa8408e56d7b1bff27072b61fd91611aa4543fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { betterAuth } from "better-auth";
import { Pool } from "pg";
const postgresUser = process.env.POSTGRES_USER || "postgres";
const postgresPassword = process.env.POSTGRES_PASSWORD || "postgres";
const postgresHost = process.env.POSTGRES_HOST || "postgres";
const postgresPort = process.env.POSTGRES_PORT || 5432;
const postgresDatabase = process.env.POSTGRES_DB || "postgres";
export const auth = betterAuth({
baseURL: process.env.BETTER_AUTH_URL,
secret: process.env.BETTER_AUTH_SECRET,
database: new Pool({
connectionString: `postgresql://${postgresUser}:${postgresPassword}@${postgresHost}:${postgresPort}/${postgresDatabase}`,
}),
socialProviders: {
discord: {
clientId: process.env.DISCORD_CLIENT_ID,
clientSecret: process.env.DISCORD_CLIENT_SECRET,
scope: ["identify", "email", "guilds", "guilds.join"],
},
},
});
|