Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { defineConfig } from 'drizzle-kit';
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set');
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set (drizzle_config)');

export default defineConfig({
dialect: 'postgresql',
schema: './src/lib/server/db/schema.ts',
out: './drizzle',
dbCredentials: {
url: process.env.DATABASE_URL,
ssl: true
url: process.env.DATABASE_URL
},
verbose: true,
strict: true,
dialect: 'postgresql'
strict: true
});
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@types/codemirror": "^5.60.15",
"@types/lodash": "^4.17.16",
"@types/node": "^22.10.2",
"@types/pg": "^8.11.13",
"amplify-adapter": "^0.2.0",
"autoprefixer": "^10.4.20",
"dotenv": "^16.4.7",
Expand Down Expand Up @@ -77,6 +78,7 @@
"html2canvas": "^1.4.1",
"lodash-es": "^4.17.21",
"lottie-web": "^5.12.2",
"pg": "^8.14.1",
"pnpm": "^10.2.1",
"postgres": "^3.4.5",
"svelte-codemirror-editor": "^1.4.1"
Expand Down
95 changes: 20 additions & 75 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 7 additions & 11 deletions src/auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SvelteKitAuth } from '@auth/sveltekit';
import GitHub from '@auth/sveltekit/providers/github';
import Google from '@auth/sveltekit/providers/google';
import { GITHUB_ID, GITHUB_SECRET, GOOGLE_ID, GOOGLE_SECRET } from '$env/static/private';
import { env } from '$env/dynamic/private';
import { DrizzleAdapter } from '@auth/drizzle-adapter';
import {
users,
Expand All @@ -13,11 +13,6 @@ import {
import { eq } from 'drizzle-orm';
import { db } from '$lib/server/db';

const githubId = GITHUB_ID || process.env.GITHUB_ID;
const githubSecret = GITHUB_SECRET || process.env.GITHUB_SECRET;
const googleId = GOOGLE_ID || process.env.GOOGLE_ID;
const googleSecret = GOOGLE_SECRET || process.env.GOOGLE_SECRET;

export const {
handle: handleAuth,
signIn,
Expand Down Expand Up @@ -63,13 +58,14 @@ export const {
},
providers: [
GitHub({
clientId: githubId,
clientSecret: githubSecret
clientId: env.GITHUB_ID,
clientSecret: env.GITHUB_SECRET
}),
Google({
clientId: googleId,
clientSecret: googleSecret
clientId: env.GOOGLE_ID,
clientSecret: env.GOOGLE_SECRET
})
],
trustHost: true
trustHost: env.AUTH_TRUST_HOST === 'true' || process.env.AUTH_TRUST_HOST === 'true',
secret: env.AUTH_SECRET
});
2 changes: 1 addition & 1 deletion src/lib/server/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const dbUrl =
env.DATABASE_URL ||
'postgres://postgres:postgres@hungrystack-db.cjcg24aqon9g.us-east-2.rds.amazonaws.com:5432/hungrystackdb';

if (!dbUrl) throw new Error('DATABASE_URL is required');
if (!dbUrl) throw new Error('DATABASE_URL is required (db-ts)');

const client = postgres(dbUrl, {
ssl: process.env.NODE_ENV === 'production' ? { rejectUnauthorized: true } : false
Expand Down
6 changes: 5 additions & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ const config = {
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter({
output: 'minimal'
})
}),
env: {
publicPrefix: 'PUBLIC_',
privatePrefix: ''
}
},

extensions: ['.svelte', '.svx']
Expand Down