UNPKG

@towercg2/server

Version:

The server runtime for the TowerCG2 video graphics system.

30 lines (29 loc) 988 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const bunyan_1 = __importDefault(require("bunyan")); const path_1 = __importDefault(require("path")); const auth_1 = require("./auth"); ; class Config { constructor() { this.port = 1776; this.logger = bunyan_1.default.createLogger({ name: "towercg2", level: "debug" }); this.authnFn = auth_1.SinglePassword("password"); this.dataDirectory = path_1.default.resolve(process.cwd(), "data"); this.plugins = []; } registerPlugin(type, config = {}) { const record = { config, type }; if (this.plugins.find(p => p.type === type)) { throw new Error(`Duplicate plugin type: ${type.name}.`); } this.plugins.push(record); } } exports.Config = Config;