Skip to content

Commit d9f3a62

Browse files
fix transport layer (#173)
* fix transport layer
1 parent 75e2f4a commit d9f3a62

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

venona/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.15
1+
1.4.16

venona/cmd/start.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

venonactl/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.15
1+
1.4.16

venonactl/pkg/codefresh/cfapi.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,12 @@ type (
7878
func NewCodefreshAPI(opt *APIOptions) API {
7979
httpClient := &http.Client{}
8080
if opt.Insecure {
81+
customTransport := &(*http.DefaultTransport.(*http.Transport)) // make shallow copy
8182
// #nosec
82-
tr := http.Transport{
83-
TLSClientConfig: &tls.Config{
84-
InsecureSkipVerify: true,
85-
},
86-
}
83+
customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
84+
8785
httpClient = &http.Client{
88-
Transport: &tr,
86+
Transport: customTransport,
8987
}
9088
}
9189

0 commit comments

Comments
 (0)