*Make the config property meta

This commit is contained in:
Derrick Hammer 2023-04-18 23:36:10 -04:00
parent e1d4785240
commit e1c57ea40b
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 2 deletions

View File

@ -20,12 +20,14 @@ import deepToFlatObject from "deep-to-flat-object";
export default class Config { export default class Config {
private module: string; private module: string;
private data = {}; private data = {};
private configProperty;
constructor(module: string) { constructor(module: string, configProperty: string) {
assert(typeof module === "string"); assert(typeof module === "string");
assert(module.length > 0); assert(module.length > 0);
this.module = module; this.module = module;
this.configProperty = configProperty;
} }
public inject(options: object) { public inject(options: object) {
@ -83,7 +85,7 @@ export default class Config {
assert(typeof data === "object"); assert(typeof data === "object");
assert(!Array.isArray(data)); assert(!Array.isArray(data));
const configDir = this.str("configdir"); const configDir = this.str(this.configProperty);
const fullPath = Path.join(configDir, `${file}.json`); const fullPath = Path.join(configDir, `${file}.json`);
if (!fs.existsSync(configDir)) { if (!fs.existsSync(configDir)) {