Add option to disable command line arguments when instanciating an app

This commit is contained in:
Alice Gaudon 2020-07-08 09:52:08 +02:00
parent e72bb08a66
commit 001e24488b
2 changed files with 6 additions and 4 deletions

View File

@ -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 <alice@gaudon.pro>",

View File

@ -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<any>[] = [];
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<Migration>[];
@ -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;
}