@travetto/config
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -21,3 +21,3 @@ { | ||
"scripts": {}, | ||
"version": "0.0.13" | ||
"version": "0.0.14" | ||
} |
@@ -1,5 +0,6 @@ | ||
import { bulkRead, bulkReadSync, AppEnv, deepMerge, isPlainObject } from '@travetto/base'; | ||
import { bulkRead, bulkReadSync, AppEnv, deepMerge, isPlainObject, bulkFindSync } from '@travetto/base'; | ||
import * as flatten from 'flat'; | ||
import * as yaml from 'js-yaml'; | ||
import { EventEmitter } from 'events'; | ||
import { readdirSync } from 'fs'; | ||
@@ -124,6 +125,6 @@ const unflatten = flatten.unflatten; | ||
// Load all namespaces from core | ||
let files = bulkReadSync('node_modules/@travetto/*/config/*.yml'); | ||
let files = bulkReadSync([/^node_modules\/@travetto\/.*\/config\/.*[.]yml$/]); | ||
// Load all configs, exclude env configs | ||
files = files.concat(bulkReadSync('config/*.yml')); | ||
files = files.concat(bulkReadSync([/^config\/.*[.]yml$/])); | ||
@@ -140,10 +141,11 @@ for (const file of files) { | ||
const loaded: string[] = []; | ||
const envFiles = bulkReadSync(`env/*.yml`, undefined, x => { | ||
const tested = x.split('/').pop()!.split('.yml')[0]; | ||
const found = AppEnv.is(tested) | ||
const envFiles = bulkReadSync([/^env\/.*[.]yml$/]).reduce((acc, x) => { | ||
const tested = x.name.split('/').pop()!.split('.yml')[0]; | ||
const found = AppEnv.is(tested); | ||
if (found) { | ||
acc.push(x.data); | ||
loaded.push(tested); | ||
} | ||
return !found; | ||
}); | ||
return acc; | ||
}, [] as string[]); | ||
@@ -153,3 +155,3 @@ console.debug('Found configurations for', loaded); | ||
for (const file of envFiles) { | ||
yaml.safeLoadAll(file.data, doc => { | ||
yaml.safeLoadAll(file, doc => { | ||
this.merge(this.data, doc); | ||
@@ -156,0 +158,0 @@ }); |
@@ -0,2 +1,4 @@ | ||
process.env.ENV = 'test'; | ||
require('@travetto/base/bootstrap').run() | ||
.then(x => require('./simple-config')); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7664
179
2