*Make the config property meta
This commit is contained in:
parent
e1d4785240
commit
e1c57ea40b
|
@ -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)) {
|
||||||
|
|
Loading…
Reference in New Issue