File tree Expand file tree Collapse file tree 2 files changed +25
-19
lines changed Expand file tree Collapse file tree 2 files changed +25
-19
lines changed Original file line number Diff line number Diff line change @@ -326,40 +326,29 @@ function sync_args_from_cmd(args) {
326
326
327
327
//Set the env variables
328
328
let sys_env_vars = undefined ;
329
+ let envs = { } ;
329
330
if ( "sys-envs" in args ) {
330
331
sys_env_vars = args [ "sys-envs" ] ;
331
332
} else if ( lt_config [ "run_settings" ] [ "sys_envs" ] ) {
332
333
sys_env_vars = lt_config [ "run_settings" ] [ "sys_envs" ] ;
333
334
}
334
335
335
-
336
-
337
- if ( sys_env_vars ) {
336
+ if ( sys_env_vars ) {
338
337
sys_env_vars = sys_env_vars . trim ( ) ;
339
338
sys_env_vars = sys_env_vars . split ( ";" ) ;
340
- let envs = { } ;
341
-
342
- let envItem ;
343
- let envKey ;
344
-
345
- // perform validation
339
+
346
340
for ( index in sys_env_vars ) {
347
341
envItem = sys_env_vars [ index ] ;
348
342
if ( envItem ) {
349
- envKey = envItem . split ( "=" ) [ 0 ] ;
350
- envKey = envKey . trim ( ) ;
351
- if ( envKey && ! constants . WHITELISTED_ENV_VARS . includes ( envKey ) ) {
352
- reject ( `Usage of unwanted environment variable detected. Allowed variables are - ${ constants . WHITELISTED_ENV_VARS } ` ) ;
353
- }
354
- envValue = envItem . split ( "=" ) [ 1 ] ;
355
- if ( envValue == undefined || envValue === "" ) {
356
- reject ( "Value of environment variable cannot be left blank" ) ;
357
- }
343
+ envKeyValue = envItem . split ( "=" ) ;
344
+ envKey = envKeyValue [ 0 ] ;
345
+ envValue = envKeyValue [ 1 ] ;
358
346
envs [ envKey ] = envValue ;
359
347
}
360
348
}
361
- lt_config [ "run_settings" ] [ "sys_envs" ] = envs ;
362
349
}
350
+ lt_config [ "run_settings" ] [ "sys_envs" ] = envs ;
351
+
363
352
364
353
//get specs from current directory if specs are not passed in config or cli
365
354
if (
Original file line number Diff line number Diff line change 1
1
const fs = require ( "fs" ) ;
2
2
const constants = require ( "./constants.js" ) ;
3
3
module . exports = validate_config = function ( lt_config , validation_configs ) {
4
+ console . log ( "validating config" ) ;
4
5
return new Promise ( function ( resolve , reject ) {
5
6
//validate auth keys are present
6
7
if (
@@ -319,6 +320,22 @@ module.exports = validate_config = function (lt_config, validation_configs) {
319
320
reject ( "Error!! boolean value is expected in reject_unauthorized key" ) ;
320
321
}
321
322
}
323
+
324
+ // validate system env variables to be set up
325
+ if ( "sys_envs" in lt_config [ "run_settings" ] ) {
326
+ let sys_envs = lt_config [ "run_settings" ] [ "sys_envs" ] ;
327
+ let envValue ;
328
+ Object . keys ( sys_envs ) . forEach ( function ( envKey ) {
329
+ envValue = sys_envs [ envKey ] ;
330
+ if ( envKey && ! constants . WHITELISTED_ENV_VARS . includes ( envKey ) ) {
331
+ reject ( `Usage of unwanted environment variable detected. Allowed variables are - ${ constants . WHITELISTED_ENV_VARS } ` ) ;
332
+ }
333
+ if ( envValue == undefined || envValue === "" ) {
334
+ reject ( "Value of environment variable cannot be left blank" ) ;
335
+ }
336
+ } )
337
+
338
+ }
322
339
resolve ( "Validated the Config" ) ;
323
340
} ) ;
324
341
} ;
You can’t perform that action at this time.
0 commit comments