Config interface
This commit is contained in:
parent
bb6d86ebbd
commit
9f6339ce48
3 changed files with 43 additions and 2 deletions
|
@ -9,12 +9,13 @@ if (!existsSync("./config.json")) {
|
|||
}
|
||||
|
||||
import { ChatHistory } from "./server/ChatHistory";
|
||||
import { Config } from "./server/interfaces/Config";
|
||||
import compression from "compression";
|
||||
import express from "express";
|
||||
import { HandleRequest, GetSharedContent } from "./server/BanchoServer";
|
||||
import { SharedContent } from "./server/interfaces/SharedContent";
|
||||
import { Registry, collectDefaultMetrics } from "prom-client";
|
||||
const config:any = JSON.parse(readFileSync(__dirname + "/config.json").toString());
|
||||
const config:Config = JSON.parse(readFileSync(__dirname + "/config.json").toString()) as Config;
|
||||
// Pull out shared data from BanchoServer
|
||||
const sharedContent:SharedContent = GetSharedContent();
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { Config } from "./interfaces/Config";
|
||||
import { ConsoleHelper } from "../ConsoleHelper";
|
||||
import { Channel } from "./objects/Channel";
|
||||
import { ChatManager } from "./ChatManager";
|
||||
|
@ -14,7 +15,7 @@ import { User } from "./objects/User";
|
|||
import { DataStreamArray } from "./objects/DataStreamArray";
|
||||
import { MultiplayerManager } from "./MultiplayerManager";
|
||||
import { SharedContent } from "./interfaces/SharedContent";
|
||||
const config:any = JSON.parse(readFileSync("./config.json").toString());
|
||||
const config:Config = JSON.parse(readFileSync("./config.json").toString()) as Config;
|
||||
// TODO: Port osu-packet to TypeScript
|
||||
const osu = require("osu-packet");
|
||||
|
||||
|
|
39
server/interfaces/Config.ts
Normal file
39
server/interfaces/Config.ts
Normal file
|
@ -0,0 +1,39 @@
|
|||
export interface Config {
|
||||
express:ExpressConfigSection,
|
||||
prometheus:PrometheusConfigSection,
|
||||
redis:RedisConfigSection,
|
||||
database:DatabaseConfigSection
|
||||
}
|
||||
|
||||
interface ExpressConfigSection {
|
||||
port:number,
|
||||
compression:boolean
|
||||
}
|
||||
|
||||
interface PrometheusConfigSection {
|
||||
enabled:boolean,
|
||||
port:number
|
||||
}
|
||||
|
||||
interface RedisConfigSection {
|
||||
enabled:boolean,
|
||||
address:string,
|
||||
port:number,
|
||||
database:number,
|
||||
password:string
|
||||
}
|
||||
|
||||
interface DatabaseConfigSection {
|
||||
address:string,
|
||||
port:number,
|
||||
username:string,
|
||||
password:string,
|
||||
name:string,
|
||||
pbkdf2:PBKDF2DatabaseConfigSection,
|
||||
key:string
|
||||
}
|
||||
|
||||
interface PBKDF2DatabaseConfigSection {
|
||||
itterations:number,
|
||||
keylength:number
|
||||
}
|
Loading…
Reference in a new issue