mirror of
https://github.com/rybbit-io/rybbit.git
synced 2025-05-10 20:05:38 +02:00
auth (#3)
* auth * Add default user * setup auth * add auth to all endpoints * Add url logging * Add tomato.gg * Add analytics * Add correct url * fix auth * log url * change base url * replace api * wip * Test * test changes * bump * Add trusted origin * f * i almost give up * stop using middleware * Fix auth * Fix build
This commit is contained in:
parent
0871ed0ef7
commit
0dc058749d
40 changed files with 1515 additions and 128 deletions
27
server/src/lib/auth.ts
Normal file
27
server/src/lib/auth.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { betterAuth } from "better-auth";
|
||||
import pg from "pg";
|
||||
import { username } from "better-auth/plugins";
|
||||
import dotenv from "dotenv";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
export const auth = betterAuth({
|
||||
basePath: "/auth",
|
||||
database: new pg.Pool({
|
||||
host: process.env.POSTGRES_HOST || "postgres",
|
||||
port: parseInt(process.env.POSTGRES_PORT || "5432", 10),
|
||||
database: process.env.POSTGRES_DB,
|
||||
user: process.env.POSTGRES_USER,
|
||||
password: process.env.POSTGRES_PASSWORD,
|
||||
}),
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
},
|
||||
plugins: [username()],
|
||||
trustedOrigins: [
|
||||
"http://localhost:3002",
|
||||
"http://localhost:3001",
|
||||
"https://tracking.tomato.gg",
|
||||
"https://tomato.gg",
|
||||
],
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue