File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,11 @@ function toBooleanConfig(configValue?: string | boolean) {
2929const envConfig = {
3030 cookiePath : process . env . HMD_CLI_COOKIE_PATH || process . env . CMD_CLI_COOKIE_PATH ,
3131 serverUrl : process . env . HMD_CLI_SERVER_URL || process . env . CMD_CLI_SERVER_URL ,
32- enterprise : ( process . env . HMD_CLI_COOKIE_PATH || process . env . HMD_CLI_SERVER_URL ) ? true : toBooleanConfig ( process . env . HMD_CLI_ENTERPRISE )
32+ enterprise : ( process . env . HMD_CLI_COOKIE_PATH || process . env . HMD_CLI_SERVER_URL )
33+ ? true
34+ : ( process . env . CMD_CLI_COOKIE_PATH || process . env . CMD_CLI_SERVER_URL )
35+ ? false
36+ : toBooleanConfig ( process . env . HMD_CLI_ENTERPRISE )
3337}
3438
3539// look for a readable config file; we can merge it with the env.
Original file line number Diff line number Diff line change @@ -65,6 +65,24 @@ describe('Config test', function () {
6565 expect ( config . enterprise ) . to . eq ( true )
6666 } )
6767
68+ it ( 'should set enterprise to false if either CMD_CLI_COOKIE_PATH or CMD_CLI_SERVER_URL are supplied' , function ( ) {
69+ fs . writeFileSync ( this . configFilePath , '{}' , 'utf8' )
70+
71+ process . env . CMD_CLI_SERVER_URL = tempDir ( )
72+ let config = requireConfig ( )
73+
74+ expect ( config . serverUrl ) . to . eq ( process . env . CMD_CLI_SERVER_URL )
75+ expect ( config . enterprise ) . to . eq ( false )
76+
77+ cleanup ( )
78+
79+ process . env . CMD_CLI_COOKIE_PATH = tempDir ( )
80+ config = requireConfig ( )
81+
82+ expect ( config . cookiePath ) . to . eq ( process . env . CMD_CLI_COOKIE_PATH )
83+ expect ( config . enterprise ) . to . eq ( false )
84+ } )
85+
6886 it ( 'should set enterprise with HMD_CLI_ENTERPRISE' , function ( ) {
6987 fs . writeFileSync ( this . configFilePath , '{}' , 'utf8' )
7088
You can’t perform that action at this time.
0 commit comments