loll
This commit is contained in:
parent
4c86e1a0df
commit
431b5681df
@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
"shopName": "Bayshore",
|
"shopName": "Bayshore",
|
||||||
"shopNickname": "BSH"
|
"shopNickname": "BSH",
|
||||||
|
"regionName": "Bayshore",
|
||||||
|
"serverIp": "127.0.0.1"
|
||||||
}
|
}
|
@ -6,8 +6,8 @@ import iconv from "iconv-lite";
|
|||||||
import { Config } from "./config";
|
import { Config } from "./config";
|
||||||
|
|
||||||
// TODO: Move this into the config
|
// TODO: Move this into the config
|
||||||
const STARTUP_URI = "https://localhost:9002";
|
const STARTUP_URI = `https://${Config.getConfig().serverIp || "localhost"}:9002`;
|
||||||
const STARTUP_HOST = "localhost:9002";
|
const STARTUP_HOST = `${Config.getConfig().serverIp || "localhost"}:9002`;
|
||||||
|
|
||||||
export default class AllnetModule extends Module {
|
export default class AllnetModule extends Module {
|
||||||
register(app: Application): void {
|
register(app: Application): void {
|
||||||
@ -71,6 +71,7 @@ export default class AllnetModule extends Module {
|
|||||||
|
|
||||||
let shopName = Config.getConfig().shopName;
|
let shopName = Config.getConfig().shopName;
|
||||||
let shopNick = Config.getConfig().shopNickname;
|
let shopNick = Config.getConfig().shopNickname;
|
||||||
|
let regionName = Config.getConfig().regionName;
|
||||||
|
|
||||||
const resParams = {
|
const resParams = {
|
||||||
stat: 1,
|
stat: 1,
|
||||||
@ -80,7 +81,7 @@ export default class AllnetModule extends Module {
|
|||||||
name: shopName,
|
name: shopName,
|
||||||
nickname: shopNick,
|
nickname: shopNick,
|
||||||
region0: "1",
|
region0: "1",
|
||||||
region_name0: "W",
|
region_name0: regionName,
|
||||||
region_name1: "X",
|
region_name1: "X",
|
||||||
region_name2: "Y",
|
region_name2: "Y",
|
||||||
region_name3: "Z",
|
region_name3: "Z",
|
||||||
|
@ -3,6 +3,8 @@ import fs from 'fs';
|
|||||||
export interface ConfigFile {
|
export interface ConfigFile {
|
||||||
shopName: string;
|
shopName: string;
|
||||||
shopNickname: string;
|
shopNickname: string;
|
||||||
|
regionName: string;
|
||||||
|
serverIp?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Config {
|
export class Config {
|
||||||
@ -16,6 +18,9 @@ export class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static getConfig(): ConfigFile {
|
static getConfig(): ConfigFile {
|
||||||
|
if (!this.cfg)
|
||||||
|
this.load();
|
||||||
|
|
||||||
return this.cfg;
|
return this.cfg;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,7 +9,6 @@ import fs from 'fs';
|
|||||||
import bodyParser from 'body-parser';
|
import bodyParser from 'body-parser';
|
||||||
import AllnetModule from './allnet';
|
import AllnetModule from './allnet';
|
||||||
import MuchaModule from './mucha';
|
import MuchaModule from './mucha';
|
||||||
import { Config } from './config';
|
|
||||||
globalAgent.options.keepAlive = true;
|
globalAgent.options.keepAlive = true;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -21,8 +20,6 @@ const PORT_ALLNET = 80;
|
|||||||
const PORT_MUCHA = 10082;
|
const PORT_MUCHA = 10082;
|
||||||
const PORT_BNGI = 9002;
|
const PORT_BNGI = 9002;
|
||||||
|
|
||||||
Config.load();
|
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(bodyParser.raw({
|
app.use(bodyParser.raw({
|
||||||
type: '*/*'
|
type: '*/*'
|
||||||
|
@ -8,7 +8,7 @@ const PORT = 10082;
|
|||||||
|
|
||||||
export default class MuchaModule extends Module {
|
export default class MuchaModule extends Module {
|
||||||
register(app: Application): void {
|
register(app: Application): void {
|
||||||
const URL_BASE = `https://localhost:${PORT}`
|
const URL_BASE = `https://${Config.getConfig().serverIp || "localhost"}:${PORT}`
|
||||||
|
|
||||||
app.use(express.urlencoded({
|
app.use(express.urlencoded({
|
||||||
type: '*/*',
|
type: '*/*',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user