File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,11 @@ function toBooleanConfig(configValue?: string | boolean) {
29
29
const envConfig = {
30
30
cookiePath : process . env . HMD_CLI_COOKIE_PATH || process . env . CMD_CLI_COOKIE_PATH ,
31
31
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 )
33
37
}
34
38
35
39
// 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 () {
65
65
expect ( config . enterprise ) . to . eq ( true )
66
66
} )
67
67
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
+
68
86
it ( 'should set enterprise with HMD_CLI_ENTERPRISE' , function ( ) {
69
87
fs . writeFileSync ( this . configFilePath , '{}' , 'utf8' )
70
88
You can’t perform that action at this time.
0 commit comments