Skip to content

Commit

Permalink
Updates YAML format to include 'okta' root (#14)
Browse files Browse the repository at this point in the history
Resolves: OKTA-130582
  • Loading branch information
jmelberg-okta committed Jun 27, 2017
1 parent b0bbd08 commit a561915
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 4 additions & 0 deletions okta.yaml
@@ -0,0 +1,4 @@
okta:
client:
orgUrl: null
token: null
2 changes: 1 addition & 1 deletion src/config-loader.js
Expand Up @@ -68,7 +68,7 @@ class ConfigLoader {
}

applyYamlFile(path) {
this.apply(yaml.safeLoad(fs.readFileSync(path)));
this.apply(yaml.safeLoad(fs.readFileSync(path)).okta);
}

apply(config) {
Expand Down
12 changes: 8 additions & 4 deletions test/unit/config-loader.js
Expand Up @@ -36,8 +36,10 @@ describe('ConfigLoader', () => {

it('should override defaults with ~/.okta/okta.yaml file', () => {
fakeFs.file(path.join(os.homedir(), '.okta', 'okta.yaml'), yaml.safeDump({
client: {
orgUrl: 'foo'
okta: {
client: {
orgUrl: 'foo'
}
}
}));
loader.applyDefaults();
Expand All @@ -51,8 +53,10 @@ describe('ConfigLoader', () => {

it('should override ~/.okta/okta.yaml with okta.yaml in the process context', () => {
fakeFs.file(path.join(process.cwd(), 'okta.yaml'), yaml.safeDump({
client: {
orgUrl: 'bar'
okta: {
client: {
orgUrl: 'bar'
}
}
}));
loader.applyDefaults();
Expand Down

0 comments on commit a561915

Please sign in to comment.