-
Notifications
You must be signed in to change notification settings - Fork 0
/
ormconfig.js
35 lines (32 loc) · 959 Bytes
/
ormconfig.js
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
const { join } = require('path');
const yaml = require('js-yaml');
const { readFileSync } = require('fs');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const YAML_CONFIG_FILENAME =
process.env.NODE_ENV === 'production'
? 'config.production.yaml'
: 'config.development.yaml';
const config = yaml.load(
readFileSync(join(__dirname, 'config', YAML_CONFIG_FILENAME), 'utf8'),
);
module.exports = {
type: 'mysql',
host: config.db.host,
ssl: {
rejectUnauthorized: true,
ca: readFileSync(join(__dirname, 'config', 'rds-ca-2019-root.pem'))
.toString(),
},
port: config.db.port || 3306,
username: config.db.username,
password: config.db.password,
database: config.db.database,
charset: config.db.charset || 'utf8mb4',
timezone: config.db.timezone || 'Z',
synchronize: false,
entities: ['src/entities/**/*.ts'],
migrations: ['migration/**/*.ts'],
cli: {
migrationsDir: 'migration',
},
};