@jacebenson/jsn 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/config.js +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacebenson/jsn",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "A command-line interface for ServiceNow that follows the Unix philosophy: simple, composable, and scriptable.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/config.js CHANGED
@@ -50,6 +50,7 @@ function loadFromFile(cfg, filePath, source) {
50
50
  }
51
51
  if (fileCfg.default_profile) {
52
52
  cfg.defaultProfile = fileCfg.default_profile;
53
+ cfg.activeProfile = fileCfg.default_profile;
53
54
  cfg.sources.default_profile = source;
54
55
  }
55
56
  if (fileCfg.profiles && typeof fileCfg.profiles === 'object') {
@@ -134,8 +135,9 @@ export function saveLocalConfig(cfg) {
134
135
  }
135
136
 
136
137
  export function getEffectiveInstance(cfg) {
137
- if (cfg.activeProfile && cfg.profiles[cfg.activeProfile] && cfg.profiles[cfg.activeProfile].instance_url) {
138
- return cfg.profiles[cfg.activeProfile].instance_url;
138
+ const name = cfg.activeProfile || cfg.defaultProfile;
139
+ if (name && cfg.profiles[name] && cfg.profiles[name].instance_url) {
140
+ return cfg.profiles[name].instance_url;
139
141
  }
140
142
  return cfg.instanceURL || '';
141
143
  }