-
Notifications
You must be signed in to change notification settings - Fork 0
/
mikro-orm.config.ts
40 lines (38 loc) · 1.55 KB
/
mikro-orm.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// This file is referenced by the application as well as the migration CLI
// The CLI use case requires the direct and indirect imports to have a .js extension.
// Additionally, the imports can not use '~'
import dotenv from "dotenv";
import { type Options, PostgreSqlDriver } from '@mikro-orm/postgresql';
import { TsMorphMetadataProvider } from '@mikro-orm/reflection';
import { Migrator } from '@mikro-orm/migrations';
import * as entities from "./domain/requirements/index.js";
import * as relations from "./domain/relations/index.js";
import * as appEntities from "./domain/application/index.js";
import AuditSubscriber from "./server/data/subscribers/AuditSubscriber.js";
dotenv.config();
const config: Options = {
extensions: [Migrator],
driver: PostgreSqlDriver,
dbName: process.env.POSTGRES_DB!,
user: process.env.POSTGRES_USER!,
host: process.env.POSTGRES_HOST!,
password: process.env.POSTGRES_PASSWORD!,
port: parseInt(process.env.POSTGRES_PORT!),
// https://github.com/mikro-orm/mikro-orm/issues/303
driverOptions: {
connection: { ssl: true }
},
entities: [
...Object.values(entities),
...Object.values(relations),
...Object.values(appEntities)
].filter((entity) => typeof entity === 'function'),
discovery: { disableDynamicFileAccess: true },
seeder: {},
subscribers: [new AuditSubscriber()],
forceUtcTimezone: true,
metadataProvider: TsMorphMetadataProvider,
debug: process.env.NODE_ENV !== 'production',
migrations: { transactional: true }
};
export default config;