Fix database seeding: include carOptions.json in server dir
The seed data file was referenced from Kenteken-Gen-1-main/ which is not copied into the Docker image. Moved carOptions.json to server/ so it's available in the container. Also added .gitignore and removed node_modules and db files from tracking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
10
server/db.js
10
server/db.js
@@ -49,18 +49,12 @@ export function initDb() {
|
||||
}
|
||||
|
||||
function seedDefaultCars() {
|
||||
const defaultCarsPath = join(__dirname, '..', 'Kenteken-Gen-1-main', 'src', 'frontend', 'carOptions.json');
|
||||
const defaultCarsPath = join(__dirname, 'carOptions.json');
|
||||
let defaultCars;
|
||||
try {
|
||||
defaultCars = JSON.parse(readFileSync(defaultCarsPath, 'utf-8'));
|
||||
} catch {
|
||||
// Fallback: try from shared-cars.json
|
||||
try {
|
||||
const sharedPath = join(__dirname, '..', 'Kenteken-Gen-1-main', 'shared-cars.json');
|
||||
defaultCars = JSON.parse(readFileSync(sharedPath, 'utf-8'));
|
||||
} catch {
|
||||
defaultCars = [];
|
||||
}
|
||||
defaultCars = [];
|
||||
}
|
||||
|
||||
const insert = db.prepare(
|
||||
|
||||
Reference in New Issue
Block a user