diff --git a/backend/config/Config.ts b/backend/config/Config.ts index 57192ace..6fb5fe89 100644 --- a/backend/config/Config.ts +++ b/backend/config/Config.ts @@ -14,4 +14,5 @@ Config.Server = { }; ConfigLoader.init(Config, path.join(__dirname, './../../config.json'), [["PORT", "Server-port"]]); + \ No newline at end of file diff --git a/backend/config/ConfigLoader.ts b/backend/config/ConfigLoader.ts index 82542d56..30287b74 100644 --- a/backend/config/ConfigLoader.ts +++ b/backend/config/ConfigLoader.ts @@ -25,6 +25,7 @@ export class ConfigLoader { let argv = optimist.argv; delete(argv._); delete(argv.$0); + console.log(argv); this.processHierarchyVar(configObject, argv); }; @@ -35,13 +36,23 @@ export class ConfigLoader { let keyArray = key.split("-"); let value = vars[key]; + //recursive settings let setObject = (object, keyArray, value) => { let key = keyArray.shift(); object[key] = {}; + if (keyArray.length == 0) { + //convert to boolean + if (value.toLowerCase && value.toLowerCase() === "false") { + value = false; + } + if (value.toLowerCase && value.toLowerCase() === "true") { + value = true; + } object[key] = value; return; } + return setObject(object[key], keyArray, value); }; setObject(config, keyArray, value); diff --git a/backend/model/memory/UserManager.ts b/backend/model/memory/UserManager.ts index 8c35de36..9c17a638 100644 --- a/backend/model/memory/UserManager.ts +++ b/backend/model/memory/UserManager.ts @@ -23,7 +23,6 @@ export class UserManager implements IUserManager { } constructor() { - console.log("ctor"); this.db = flatfile.sync(path.join(ProjectPath.Root, 'users.db')); if (!this.db.has("idCounter")) { @@ -33,6 +32,7 @@ export class UserManager implements IUserManager { if (!this.db.has("users")) { this.db.put("users", []); + //TODO: remove defaults this.createUser(new User("developer", "developer", UserRoles.Developer)); this.createUser(new User("admin", "admin", UserRoles.Admin)); this.createUser(new User("user", "user", UserRoles.User));