diff --git a/wrapper/src/config.ts b/wrapper/src/config.ts index 33be789..6cc6b4e 100644 --- a/wrapper/src/config.ts +++ b/wrapper/src/config.ts @@ -10,6 +10,12 @@ export interface WrapperConfig { } +export const RABBITMQ_URL = "amqp://manager:gigi1337@192.168.1.74"; +export const WRAPPER_HEARTBEAT_INTERVAL = 10000; +export const WRAPPER_STATUS_INTERVAL = 10000; +export const WRAPPER_QUERY_INTERVAL = 5000; +export const SERVER_SCRIPT_PATH = "/home/heroes/HeroesOfValorServer.sh"; +export const SERVER_WORKING_DIRECTORY = "/home/heroes"; export function loadConfig(): WrapperConfig { diff --git a/wrapper/src/index.ts b/wrapper/src/index.ts index 07eeaef..c7852b4 100644 --- a/wrapper/src/index.ts +++ b/wrapper/src/index.ts @@ -1,6 +1,6 @@ import * as amqp from "amqplib"; import os from "os"; -import { loadConfig, saveConfig } from "./config"; +import { loadConfig, saveConfig, RABBITMQ_URL, WRAPPER_HEARTBEAT_INTERVAL } from "./config"; import { ProcessManager } from "./processManager"; import { StatusReporter } from "./statusReporter"; import { QueryManager } from "./queryManager"; @@ -67,7 +67,7 @@ class Wrapper { this.connection = await amqp.connect( - "amqp://manager:gigi1337@192.168.1.74" + RABBITMQ_URL ); @@ -444,7 +444,7 @@ class Wrapper { - },10000); +},WRAPPER_HEARTBEAT_INTERVAL); } diff --git a/wrapper/src/processManager.ts b/wrapper/src/processManager.ts index 661332f..c985c3d 100644 --- a/wrapper/src/processManager.ts +++ b/wrapper/src/processManager.ts @@ -1,5 +1,6 @@ import { spawn, ChildProcess } from "child_process"; import { ServerStartCommand } from "server-manager-shared"; +import { SERVER_SCRIPT_PATH, SERVER_WORKING_DIRECTORY } from "./config"; interface ServerProcess { @@ -68,10 +69,10 @@ export class ProcessManager { const process = spawn( - "/home/heroes/HeroesOfValorServer.sh", + SERVER_SCRIPT_PATH, args, { - cwd:"/home/heroes", + cwd: SERVER_WORKING_DIRECTORY, stdio:"pipe", detached:true } diff --git a/wrapper/src/queryManager.ts b/wrapper/src/queryManager.ts index 364b647..48484f6 100644 --- a/wrapper/src/queryManager.ts +++ b/wrapper/src/queryManager.ts @@ -1,5 +1,6 @@ import { queryGameServerInfo } from "steam-server-query"; import { ProcessManager } from "./processManager"; +import { WRAPPER_QUERY_INTERVAL } from "./config"; export class QueryManager { @@ -27,7 +28,7 @@ export class QueryManager { this.updateQueries(); - },5000); + },WRAPPER_QUERY_INTERVAL); } diff --git a/wrapper/src/statusReporter.ts b/wrapper/src/statusReporter.ts index ea41373..40e593e 100644 --- a/wrapper/src/statusReporter.ts +++ b/wrapper/src/statusReporter.ts @@ -3,7 +3,7 @@ import { ProcessManager } from "./processManager"; import os from "os"; import { QueryManager } from "./queryManager"; import { WrapperStatusMessage } from "server-manager-shared"; - +import { WRAPPER_STATUS_INTERVAL } from "./config"; export class StatusReporter { @@ -36,7 +36,7 @@ export class StatusReporter { this.sendStatus(); - },10000); + },WRAPPER_STATUS_INTERVAL); }