Ignore cert option
This commit is contained in:
parent
ae28c4911f
commit
a4c37eab08
|
@ -0,0 +1,5 @@
|
|||
iso:
|
||||
user: example@example.com
|
||||
password: fluffy123
|
||||
# noVerifyCert: false
|
||||
|
|
@ -6,8 +6,9 @@ import (
|
|||
)
|
||||
|
||||
type Conf struct {
|
||||
ISOUser string
|
||||
ISOPassword string
|
||||
ISOUser string
|
||||
ISOPassword string
|
||||
NoVerifyCert bool
|
||||
}
|
||||
|
||||
func Config() *Conf {
|
||||
|
@ -19,8 +20,13 @@ func Config() *Conf {
|
|||
panic(fmt.Errorf("fatal error config file: %w", err))
|
||||
}
|
||||
|
||||
noVerifyCert := false
|
||||
if nVC, exists := viper.Get("iso.noVerifyCert").(bool); exists {
|
||||
noVerifyCert = nVC
|
||||
}
|
||||
return &Conf{
|
||||
ISOUser: viper.Get("iso.user").(string),
|
||||
ISOPassword: viper.Get("iso.password").(string),
|
||||
ISOUser: viper.Get("iso.user").(string),
|
||||
ISOPassword: viper.Get("iso.password").(string),
|
||||
NoVerifyCert: noVerifyCert,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package isoclient
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
@ -32,6 +33,9 @@ func New(cfg *config.Conf) Client {
|
|||
passwd: cfg.ISOPassword,
|
||||
Debug: os.Getenv("DEBUG") == "true",
|
||||
}
|
||||
if cfg.NoVerifyCert {
|
||||
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue