in src/lib/database.ts [22:42]
constructor() {
if (process.env.NODE_ENV === 'development') {
// use the firestore emulator
this.db = new Firestore({
host: "localhost:9999",
projectId: "demo-test",
ssl: false,
});
} else {
// use the PROJECT_ID environment variable
const projectId = process.env.PROJECT_ID;
if (!projectId) {
const errMessage = "PROJECT_ID environment variable must be defined.";
console.error(errMessage);
throw new Error(errMessage);
}
this.db = new Firestore({
projectId: projectId,
});
}
}