Skip to content

Commit

Permalink
feat(auth): implement environment-based configuration options
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Goniszewski <[email protected]>
  • Loading branch information
goniszewski committed Sep 13, 2024
1 parent 1464b8d commit bc12c16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ services:
restart: unless-stopped
environment:
- PORT=5173
- PUBLIC_HTTPS_ONLY=false
- PUBLIC_SIGNUP_DISABLED=false
volumes:
- grimoire_data:/app/data/
build:
Expand Down
5 changes: 2 additions & 3 deletions src/lib/server/auth.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { dev } from '$app/environment';
import config from '$lib/config';
import { db } from '$lib/database/db';
import { sessionSchema, userSchema } from '$lib/database/schema';
import { Lucia } from 'lucia';

import { DrizzleSQLiteAdapter } from '@lucia-auth/adapter-drizzle';

import type { RequestEvent } from '@sveltejs/kit';

export const adapter = new DrizzleSQLiteAdapter(db, sessionSchema, userSchema);

export const lucia = new Lucia(adapter, {
sessionCookie: {
attributes: {
secure: !dev
secure: config.HTTPS_ONLY
}
},
getUserAttributes: (attributes) => {
Expand Down

0 comments on commit bc12c16

Please sign in to comment.