Skip to content

Commit

Permalink
chore: Replaced flat dependency with safe-flat
Browse files Browse the repository at this point in the history
OKTA-367717
<<<Jenkins Check-In of Tested SHA: 2e9807b for [email protected]>>>
Artifact: okta-sdk-nodejs
  • Loading branch information
denysoblohin-okta authored and eng-prod-CI-bot-okta committed Feb 23, 2021
1 parent 06a4d8e commit dc5283c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 354 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
"repository": "https://github.com/okta/okta-sdk-nodejs",
"dependencies": {
"deep-copy": "^1.4.2",
"flat": "^5.0.2",
"isomorphic-fetch": "^3.0.0",
"js-yaml": "^3.14.1",
"lodash": "^4.17.20",
"mocha-junit-reporter": "^2.0.0",
"njwt": "^1.0.0",
"parse-link-header": "^1.0.1",
"rasha": "^1.2.5"
"rasha": "^1.2.5",
"safe-flat": "^2.0.2"
},
"devDependencies": {
"@okta/openapi": "^2.1.6",
Expand Down
7 changes: 3 additions & 4 deletions src/config-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

const _ = require('lodash');
const fs = require('fs');
const flat = require('flat');
const os = require('os');
const path = require('path');
const yaml = require('js-yaml');
const flat = require('safe-flat');

class ConfigLoader {

Expand Down Expand Up @@ -57,8 +57,7 @@ class ConfigLoader {
applyEnvVars() {
const delimiter = '_';
const prefix = this.prefix;
const flatConfig = { delimiter: delimiter };
const flattendDefaultConfig = flat.flatten(this.config, flatConfig);
const flattendDefaultConfig = flat.flatten(this.config, delimiter);

var flatEnvValues = Object.keys(flattendDefaultConfig)
.reduce((envVarMap, key) => {
Expand All @@ -71,7 +70,7 @@ class ConfigLoader {
return envVarMap;
}, {});

const envConfig = flat.unflatten(flatEnvValues, flatConfig);
const envConfig = flat.unflatten(flatEnvValues, delimiter);
this.apply(envConfig);
}

Expand Down
Loading

0 comments on commit dc5283c

Please sign in to comment.