Complete docker build in preparation for app-runner deployment
This commit is contained in:
+5
-3
@@ -3,21 +3,23 @@ import { prismaAdapter } from "better-auth/adapters/prisma";
|
||||
import { prisma } from "$lib/db";
|
||||
import { sveltekitCookies } from "better-auth/svelte-kit";
|
||||
import { getRequestEvent } from "$app/server";
|
||||
import { env } from "$env/dynamic/private";
|
||||
|
||||
|
||||
export const auth = betterAuth({
|
||||
baseURL: process.env.BETTER_AUTH_URL,
|
||||
baseURL: env.BETTER_AUTH_URL,
|
||||
database: prismaAdapter(prisma, {
|
||||
provider: "postgresql",
|
||||
}),
|
||||
secret: env.BETTER_AUTH_SECRET,
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
},
|
||||
socialProviders: {
|
||||
google: {
|
||||
prompt: "select_account",
|
||||
clientId: process.env.GOOGLE_CLIENT_ID as string,
|
||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
|
||||
clientId: env.GOOGLE_CLIENT_ID as string,
|
||||
clientSecret: env.GOOGLE_CLIENT_SECRET,
|
||||
}
|
||||
},
|
||||
plugins: [sveltekitCookies(getRequestEvent)],
|
||||
|
||||
+2
-11
@@ -1,23 +1,14 @@
|
||||
import 'dotenv/config';
|
||||
import fs from 'fs';
|
||||
import pg from 'pg';
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import { PrismaClient } from '$lib/generated/prisma/client';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
let _prisma: PrismaClient | undefined;
|
||||
|
||||
function getPrisma(): PrismaClient {
|
||||
if (!_prisma) {
|
||||
const ca_cert = process.env.DO_CA_CERTIFICATE ?? '';
|
||||
|
||||
const pool = new pg.Pool({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
ssl: ca_cert
|
||||
? {
|
||||
rejectUnauthorized: true,
|
||||
ca: fs.readFileSync(ca_cert).toString()
|
||||
}
|
||||
: undefined
|
||||
connectionString: env.DATABASE_URL
|
||||
});
|
||||
|
||||
const adapter = new PrismaPg(pool);
|
||||
|
||||
Reference in New Issue
Block a user