Skip to content

Commit 0948d9f

Browse files
author
David Blackman
committed
one more set of fixes for key_type
1 parent f452c8a commit 0948d9f

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@radarlabs/api-diff",
3-
"version": "1.0.35",
3+
"version": "1.0.36",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

src/apiEnv.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,23 @@ export function findApiKey(
125125
* @returns {ApiEnv} filled in ApiEnv
126126
*/
127127
export function argvToApiEnv(
128-
argv: Partial<ApiEnv> | undefined,
128+
argv?: any,
129129
exitOnFailure?: boolean,
130130
): ApiEnv {
131-
let apiEnv: Partial<ApiEnv> = _.clone(argv) || {};
131+
let apiEnv: Partial<ApiEnv> = {};
132+
133+
if (argv.key) {
134+
apiEnv.key = argv.key;
135+
}
136+
if (argv.host) {
137+
apiEnv.host = argv.host;
138+
}
139+
if (argv.key_env) {
140+
apiEnv.keyEnv = argv.key_env;
141+
}
142+
if (argv.keyType) {
143+
apiEnv.keyType = argv.key_type;
144+
}
132145

133146
let aliasedHostEntry: ConfigHostEntry;
134147
_.forEach(config.hosts, (hostEntry: ConfigHostEntry, hostKey: string) => {
@@ -155,7 +168,7 @@ export function argvToApiEnv(
155168
// keyEnv is either the env specified in the hostEntry or just the
156169
// name of the hostConfig. For example, localhost might specify keyEnv: staging,
157170
// while the hostConfig for "staging" wouldn't need to do so
158-
hostEntry.keyEnv = argv.keyEnv || hostEntry.keyEnv || hostKey;
171+
hostEntry.keyEnv = hostEntry.keyEnv || hostKey;
159172

160173
hostEntry.keyType = hostEntry.keyType || _.first(config.keyTypes);
161174

0 commit comments

Comments
 (0)