4
4
* both for constructing the command line flags to specify one, and for interpreting the
5
5
* values of those command line flags into an ApiEnv object
6
6
*/
7
+ import * as queryString from 'querystring' ;
7
8
import * as _ from 'lodash' ;
8
9
import yargs from 'yargs' ;
9
10
import * as os from 'os' ;
@@ -23,6 +24,7 @@ export interface ApiEnv {
23
24
host : string ;
24
25
keyEnv : string ;
25
26
keyType ?: string ;
27
+ extraParams ?: Record < string , string > ;
26
28
}
27
29
28
30
type YargsOptionMapping = Record < string , yargs . Options > ;
@@ -39,6 +41,12 @@ const apiEnvCommandLineOptions: YargsOptionMapping = {
39
41
description :
40
42
'Authorization key, if not specified will try to find one in the env or in ~/.api-keys.env' ,
41
43
} ,
44
+ extra_params : {
45
+ type : 'array' ,
46
+ default : [ ] ,
47
+ description :
48
+ 'Extra static parameters that will be added to each query sent to this host, used for testing differences caused by slightly different query params' ,
49
+ } ,
42
50
} ;
43
51
44
52
/**
@@ -142,6 +150,9 @@ export function argvToApiEnv(
142
150
if ( argv . keyType ) {
143
151
apiEnv . keyType = argv . key_type ;
144
152
}
153
+ if ( argv . extra_params ) {
154
+ apiEnv . extraParams = queryString . parse ( argv . extra_params . join ( '&' ) ) as Record < string , string > ;
155
+ }
145
156
146
157
let aliasedHostEntry : ConfigHostEntry ;
147
158
_ . forEach ( config . hosts , ( hostEntry : ConfigHostEntry , hostKey : string ) => {
0 commit comments