@@ -2,6 +2,7 @@ const constants = require("./constants.js");
22const fs = require ( "fs" ) ;
33const path = require ( "path" ) ;
44const process = require ( "process" ) ;
5+ const { type } = require ( "os" ) ;
56
67function write_file ( file_path , content ) {
78 fs . writeFileSync ( file_path , content , function ( err ) {
@@ -327,39 +328,39 @@ function sync_args_from_cmd(args) {
327328 let sys_env_vars = undefined ;
328329 if ( "sys-envs" in args ) {
329330 sys_env_vars = args [ "sys-envs" ] ;
330- sys_env_vars = sys_env_vars . trim ( ) ;
331- sys_env_vars = sys_env_vars . split ( "," ) ;
332331 } else if ( lt_config [ "run_settings" ] [ "sys_envs" ] ) {
333-
334332 sys_env_vars = lt_config [ "run_settings" ] [ "sys_envs" ] ;
335- sys_env_vars = sys_env_vars . trim ( ) ;
336- sys_env_vars = sys_env_vars . split ( ";" ) ;
337333 }
338334
339335
340336
341337 if ( sys_env_vars ) {
338+ sys_env_vars = sys_env_vars . trim ( ) ;
339+ sys_env_vars = sys_env_vars . split ( ";" ) ;
342340 let envs = { } ;
343- console . log ( sys_env_vars ) ;
341+
344342 let envItem ;
345343 let envKey ;
346344
345+ // perform validation
347346 for ( index in sys_env_vars ) {
348347 envItem = sys_env_vars [ index ] ;
349348 if ( envItem ) {
350- // TODO: trim spaces from the key and value
351349 envKey = envItem . split ( "=" ) [ 0 ] ;
350+ envKey = envKey . trim ( ) ;
352351 if ( envKey && ! constants . WHITELISTED_ENV_VARS . includes ( envKey ) ) {
353- reject ( `usage of unwanted environment variable detected. Allowed variables are - ${ constants . WHITELISTED_ENV_VARS } ` ) ;
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" ) ;
354357 }
355- envs [ envKey ] = envItem . split ( "=" ) [ 1 ] ;
358+ envs [ envKey ] = envValue ;
356359 }
357-
358360 }
359361 lt_config [ "run_settings" ] [ "sys_envs" ] = envs ;
360362 }
361363
362- console . log ( "lt_config - " , lt_config ) ;
363364 //get specs from current directory if specs are not passed in config or cli
364365 if (
365366 ( lt_config [ "run_settings" ] [ "specs" ] == undefined ||
0 commit comments