yrgljhdnyeglrthsgilsyergthu
This commit is contained in:
parent
a04867d4c7
commit
02f4164cd7
|
@ -24,6 +24,7 @@ COPY . .
|
||||||
|
|
||||||
ENV NEXT_TELEMETRY_DISABLED 1
|
ENV NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
|
ENV CREDENTIALS_DB_PATH=balls
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Production image, copy all the files and run next
|
# Production image, copy all the files and run next
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
import sqlite from "sqlite3";
|
import sqlite from "sqlite3";
|
||||||
import bcrypt from "bcryptjs";
|
import bcrypt from "bcryptjs";
|
||||||
|
import { PHASE_PRODUCTION_BUILD } from "next/dist/shared/lib/constants";
|
||||||
|
|
||||||
const { CREDENTIALS_DB_PATH } = process.env;
|
const { CREDENTIALS_DB_PATH } = process.env;
|
||||||
|
|
||||||
export const database = () => {
|
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";
|
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) {
|
export function validateCredentials(email: string, password: string) {
|
||||||
|
|
Loading…
Reference in a new issue