@@ -74,12 +74,13 @@ func init() {
7474 dieOnError (viper .BindEnv ("config-dir" , "VENONA_CONFIG_DIR" ))
7575 dieOnError (viper .BindEnv ("port" , "PORT" ))
7676 dieOnError (viper .BindEnv ("NODE_TLS_REJECT_UNAUTHORIZED" ))
77+ dieOnError (viper .BindEnv ("verbose" , "VERBOSE" ))
7778
7879 viper .SetDefault ("codefresh-host" , defaultCodefreshHost )
7980 viper .SetDefault ("port" , "8080" )
8081 viper .SetDefault ("NODE_TLS_REJECT_UNAUTHORIZED" , "1" )
8182
82- startCmd .Flags ().BoolVar (& startCmdOptions .verbose , "verbose" , false , "Show more logs" )
83+ startCmd .Flags ().BoolVar (& startCmdOptions .verbose , "verbose" , viper . GetBool ( "verbose" ) , "Show more logs" )
8384 startCmd .Flags ().BoolVar (& startCmdOptions .rejectTLSUnauthorized , "tls-reject-unauthorized" , viper .GetBool ("NODE_TLS_REJECT_UNAUTHORIZED" ), "Disable certificate validation for TLS connections" )
8485 startCmd .Flags ().StringVar (& startCmdOptions .agentID , "agent-id" , viper .GetString ("agent-id" ), "ID of the agent [$AGENT_ID]" )
8586 startCmd .Flags ().StringVar (& startCmdOptions .configDir , "config-dir" , viper .GetString ("config-dir" ), "path to configuration folder [$CONFIG_DIR]" )
@@ -136,17 +137,14 @@ func run(options startOptions) {
136137 }
137138 var cf codefresh.Codefresh
138139 {
139-
140140 var httpClient http.Client
141141 if ! options .rejectTLSUnauthorized {
142+ customTransport := & (* http .DefaultTransport .(* http.Transport )) // make shallow copy
142143 // #nosec
143- tr := http.Transport {
144- TLSClientConfig : & tls.Config {
145- InsecureSkipVerify : true ,
146- },
147- }
144+ customTransport .TLSClientConfig = & tls.Config {InsecureSkipVerify : true }
145+
148146 httpClient = http.Client {
149- Transport : & tr ,
147+ Transport : customTransport ,
150148 }
151149 }
152150
0 commit comments