Skip to content

Commit

Permalink
add config for insecure skip verify
Browse files Browse the repository at this point in the history
  • Loading branch information
philchia committed May 26, 2020
1 parent b202199 commit dd7f2ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
9 changes: 8 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package agollo

import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"net/http"
Expand Down Expand Up @@ -37,7 +38,13 @@ type result struct {
// NewClient create client from conf
func NewClient(conf *Conf) *Client {
conf.normalize()
httpClient := &http.Client{Timeout: queryTimeout}
httpClient := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: conf.InsecureSkipVerify},
},
Timeout: queryTimeout,
}

agolloClient := &Client{
conf: conf,
caches: newNamespaceCahce(),
Expand Down
13 changes: 7 additions & 6 deletions conf.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import (

// Conf ...
type Conf struct {
AppID string `json:"appId,omitempty"`
Cluster string `json:"cluster,omitempty"`
NameSpaceNames []string `json:"namespaceNames,omitempty"`
CacheDir string `json:"cacheDir,omitempty"`
MetaAddr string `json:"meta_addr"`
AccesskeySecret string `json:"accesskey_secret"`
AppID string `json:"appId,omitempty"`
Cluster string `json:"cluster,omitempty"`
NameSpaceNames []string `json:"namespaceNames,omitempty"`
CacheDir string `json:"cacheDir,omitempty"`
MetaAddr string `json:"meta_addr"`
AccesskeySecret string `json:"accesskey_secret"`
InsecureSkipVerify bool `json:"insecure_skip_verify"`
}

// NewConf create Conf from file
Expand Down

0 comments on commit dd7f2ef

Please sign in to comment.