-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmikro-orm.config.ts
More file actions
43 lines (39 loc) · 1.08 KB
/
mikro-orm.config.ts
File metadata and controls
43 lines (39 loc) · 1.08 KB
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
41
42
43
import "dotenv/config";
import { defineConfig, PostgreSqlDriver } from "@mikro-orm/postgresql";
import { Migrator } from "@mikro-orm/migrations";
import { SeedManager } from "@mikro-orm/seeder";
import { entities } from './src/entities/index.entity';
import { IS_DEV_OR_STAGING } from "src/utils/environment";
import { MikroORMLogger } from "src/security/loggers/mikro-orm-logger";
const getConnectionStrategy = () => {
const isNeon = process.env.DATABASE_URL?.includes('neon.tech');
if(isNeon) {
return {
ssl: {
rejectUnauthorized: false, // required for Neon
}
}
}
return {
ssl: false
}
}
export default defineConfig({
driver: PostgreSqlDriver,
clientUrl: process.env.DATABASE_URL!,
entities: entities,
extensions: [Migrator, SeedManager],
driverOptions: {
connection: getConnectionStrategy()
},
debug: IS_DEV_OR_STAGING,
migrations: {
path: "dist/src/migrations",
pathTs: "src/migrations",
},
seeder: {
path: "dist/src/seeders",
pathTs: "src/seeders"
},
loggerFactory: (options) => new MikroORMLogger(options)
});