-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice.orm.js
39 lines (38 loc) · 1.18 KB
/
service.orm.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
36
37
38
39
require("dotenv").config()
const typeorm = require("typeorm")
const dataSource_service = new typeorm.DataSource({
type: "mysql",
host: process.env.SERVICE_DB_HOST,
port: process.env.SERVICE_DB_PORT,
username: process.env.SERVICE_DB_USERNAME,
password: process.env.SERVICE_DB_PASSWORD,
database: process.env.SERVICE_DB_NAME,
synchronize: false,
logging: false,
entities: [
require("./service.entity/champ"),
require("./service.entity/champ.rate"),
require("./service.entity/champ.spell"),
require("./service.entity/champ.skill"),
require('./service.entity/combination.stat'),
require("./service.entity/simulation"),
],
})
module.exports = {
async connectService() {
await dataSource_service
.initialize()
.then(function () {
console.log("서비스용 연결 완료")
})
.catch(function (error) {
console.log("Error: ", error)
})
},
async closeService() {
await dataSource_service.destroy().then(() => {
console.log("서비스용 연결 해제")
})
},
dataSource_service,
}