yrgljhdnyeglrthsgilsyergthu

This commit is contained in:
Lea 2024-01-17 12:54:57 +01:00
parent a04867d4c7
commit 02f4164cd7
Signed by: Lea
GPG key ID: 1BAFFE8347019C42
2 changed files with 6 additions and 2 deletions

View file

@ -24,6 +24,7 @@ COPY . .
ENV NEXT_TELEMETRY_DISABLED 1
ENV CREDENTIALS_DB_PATH=balls
RUN npm run build
# Production image, copy all the files and run next

View file

@ -1,14 +1,17 @@
import sqlite from "sqlite3";
import bcrypt from "bcryptjs";
import { PHASE_PRODUCTION_BUILD } from "next/dist/shared/lib/constants";
const { CREDENTIALS_DB_PATH } = process.env;
export const database = () => {
if (!CREDENTIALS_DB_PATH) {
if (!CREDENTIALS_DB_PATH && process.env.NEXT_PHASE != PHASE_PRODUCTION_BUILD) {
throw "$CREDENTIALS_DB_PATH not provided; unable to connect to database";
}
return new sqlite.Database(CREDENTIALS_DB_PATH!);
return new sqlite.Database(CREDENTIALS_DB_PATH!, (err: any) => {
if (err && process.env.NEXT_PHASE != PHASE_PRODUCTION_BUILD) throw err;
});
};
export function validateCredentials(email: string, password: string) {