Commit 8cb3b779 authored by Lakr Aream's avatar Lakr Aream 👼🏽

完成初始化

parent e760a43b
......@@ -15,7 +15,7 @@ app:
# Database Config For Backend Application
database:
host: "127.0.0.1" # database host name
host: "iomun.cn" # database host name
port: 15092 # database port
user: "root" # database user name
base: "Candiay" # database name
......
import mysql from "mysql"
import { ConfigManager } from "./config"
import { StatusManager } from "./status"
export class DataBase {
......@@ -10,7 +11,6 @@ export class DataBase {
private user: string
private pass: string
private base: string // which database to use
private url: string
private connection: any = undefined
......@@ -22,8 +22,6 @@ export class DataBase {
this.user = object.database.user
this.pass = object.database.pass
this.base = object.database.base
const uuu = String(this.host + ":" + String(this.port))
this.url = uuu
this.setupConnect()
}
......@@ -34,13 +32,16 @@ export class DataBase {
console.log("DataBase Inf - user " + this.user + "")
console.log("DataBase Inf - pass " + this.pass + "")
console.log("DataBase Inf - base " + this.base + "")
console.log("DataBase Inf - url " + this.url + "")
}
private connectRetryTimes = 0
private setupConnect(doSetup: boolean = true) {
if (this.connection !== undefined) {
this.connection.destroy()
}
this.connection = mysql.createConnection({
host : this.host,
port : this.port,
user : this.user,
password : this.pass,
database : this.base,
......@@ -113,13 +114,8 @@ export class DataBase {
console.error("[fatal] Database setup failed")
process.exit()
}
this.configRootUser()
StatusManager.shared.configSuccessed = true
})
}
private configRootUser() {
}
}
\ No newline at end of file
......@@ -14,9 +14,10 @@ coreApp.get("/", (req, res) => {
if (!StatusManager.shared.configSuccessed) {
res.send("Application in configuration")
return
}
res.send("Candiay Core")
res.send("Candiay Core Bootstrap Succeed")
})
// Start servers
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment