Fix: Use .js extension for entities in production, fix nginx proxy path
This commit is contained in:
@@ -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
|
||||
});
|
||||
Reference in New Issue
Block a user