mirror of
https://github.com/smogon/pokemon-showdown-loginserver.git
synced 2026-04-26 01:31:42 -05:00
many fixes
This commit is contained in:
parent
06ca90694f
commit
7e0a9d62d6
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,4 +1,4 @@
|
|||
node_modules
|
||||
.dist
|
||||
.eslintcache
|
||||
config/config.js
|
||||
config/*
|
||||
7
config/pm2-example.js
Normal file
7
config/pm2-example.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
apps: [{
|
||||
name: "loginserver",
|
||||
script: "./.dist/src",
|
||||
exec_mode: "cluster",
|
||||
}],
|
||||
};
|
||||
|
|
@ -7,10 +7,10 @@
|
|||
"scripts": {
|
||||
"lint": "eslint . --cache --ext .js,.ts",
|
||||
"build": "npx tsc",
|
||||
"start": "npx tsc && npx pm2 start ./.dist/src --name loginserver --time",
|
||||
"start": "npx tsc && npx pm2 start config/pm2.js",
|
||||
"test": "npm run lint && npx tsc",
|
||||
"reload": "npx tsc && npx pm2 reload loginserver",
|
||||
"stop": "npx pm2 stop loginserver"
|
||||
"reload": "npx tsc && npx pm2 reload config/pm2.js",
|
||||
"stop": "npx pm2 stop config/pm2.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "^15.12.4",
|
||||
|
|
|
|||
|
|
@ -15,13 +15,12 @@ export const databases: PSDatabase[] = [];
|
|||
export class PSDatabase {
|
||||
pool: mysql.Pool;
|
||||
prefix: string;
|
||||
constructor(config: {[k: string]: any} = Config.mysql, prefix?: string) {
|
||||
constructor(config: {[k: string]: any} = {...Config.mysql}) {
|
||||
this.prefix = config.prefix || "";
|
||||
if (config.prefix) {
|
||||
prefix = config.prefix;
|
||||
delete config.prefix;
|
||||
}
|
||||
this.pool = mysql.createPool(config);
|
||||
this.prefix = prefix || "";
|
||||
if (!databases.includes(this)) databases.push(this);
|
||||
}
|
||||
query<T = ResultRow>(query: SQLStatement) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user