generator-jhipster
Version:
Spring Boot + Angular/React/Vue in one handy generator
26 lines (25 loc) • 1.02 kB
JavaScript
export function loadConfig(configsDef, { application, config }) {
if (configsDef) {
for (const [name, def] of Object.entries(configsDef)) {
let value = application[name];
if (value === undefined || value === null) {
let source = config;
if (!source) {
switch (def.scope) {
case 'blueprint': {
// TODO Convert type to BaseGenerator
source = this.blueprintStorage.getAll();
break;
}
}
}
if (source) {
value = application[name] = source[name] ?? undefined;
if (value === undefined && def.default !== undefined) {
application[name] = typeof def.default === 'function' ? def.default.call(this, source) : def.default;
}
}
}
}
}
}