From 001e24488b147751eee8d85660d8fa8d18197b52 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 8 Jul 2020 09:52:08 +0200 Subject: [PATCH] Add option to disable command line arguments when instanciating an app --- package.json | 2 +- src/Application.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 72fb90a..d5d67fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wms-core", - "version": "0.10.19", + "version": "0.10.20", "description": "Node web framework", "repository": "git@gitlab.com:ArisuOngaku/wms-core.git", "author": "Alice Gaudon ", diff --git a/src/Application.ts b/src/Application.ts index 2db1f0a..f448daf 100644 --- a/src/Application.ts +++ b/src/Application.ts @@ -10,19 +10,21 @@ import Migration from "./db/Migration"; import {Type} from "./Utils"; import LogRequestsComponent from "./components/LogRequestsComponent"; import {ValidationBag} from "./db/Validator"; -import TemplateError = lib.TemplateError; import config from "config"; +import TemplateError = lib.TemplateError; export default abstract class Application { private readonly version: string; + private readonly ignoreCommandLine: boolean; private readonly controllers: Controller[] = []; private readonly webSocketListeners: { [p: string]: WebSocketListener } = {}; private readonly components: ApplicationComponent[] = []; private ready: boolean = false; - protected constructor(version: string) { + protected constructor(version: string, ignoreCommandLine: boolean = false) { this.version = version; + this.ignoreCommandLine = ignoreCommandLine; } protected abstract getMigrations(): Type[]; @@ -52,7 +54,7 @@ export default abstract class Application { MysqlConnectionManager.registerMigrations(this.getMigrations()); // Process command line - if (await this.processCommandLine()) { + if (!this.ignoreCommandLine && await this.processCommandLine()) { await this.stop(); return; }