Fix: Use .js extension for entities in production, fix nginx proxy path

This commit is contained in:
Donat Magda
2025-11-26 00:05:06 +01:00
parent 8c27b5ea2f
commit 5eb4d3eef7
2 changed files with 65 additions and 2 deletions
@@ -1,6 +1,9 @@
import { DataSource } from 'typeorm';
import { join } from 'path';
// Use .js extension in production (compiled) and .ts in development
const ext = __filename.endsWith('.js') ? 'js' : 'ts';
export const AppDataSource = new DataSource({
type: 'postgres',
host: process.env.DB_HOST || 'localhost',
@@ -10,8 +13,8 @@ export const AppDataSource = new DataSource({
database: process.env.DB_NAME || 'serpentrace',
synchronize: false, // Set to false when using migrations
logging: process.env.NODE_ENV === 'development',
entities: [join(__dirname, '../Domain/**/*Aggregate.ts')],
migrations: [join(__dirname, './Migrations/*.ts')],
entities: [join(__dirname, `../Domain/**/*Aggregate.${ext}`)],
migrations: [join(__dirname, `./Migrations/*.${ext}`)],
migrationsTableName: 'migrations',
migrationsRun: false // Let migrations run manually
});