forked from Corsace/corsace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathormconfig.ts
30 lines (28 loc) · 815 Bytes
/
ormconfig.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
import { config } from "node-config-ts";
import { DataSource } from "typeorm";
import { resolve } from "path";
const ormConfig = new DataSource({
name: "default",
type: "mariadb",
host: config.database.host,
port: config.database.port,
database: config.database.database,
username: config.database.username,
password: config.database.password,
timezone: "Z",
synchronize: false,
logging: ["error"],
maxQueryExecutionTime: 50,
entities: [
`${resolve(__dirname, "Models")}/**/*.ts`,
`${resolve(__dirname, "Models")}/**/*.js`,
],
cache: {
duration: 60000,
},
migrations: [
`${resolve(__dirname, "Models/migrations")}/*.ts`,
`${resolve(__dirname, "Models/migrations")}/*.js`,
],
});
export default ormConfig;