remove tls skip verify, use os.Root for config reading

This commit is contained in:
2026-05-28 19:51:41 +00:00
parent f430589512
commit 64a018f1b5
2 changed files with 10 additions and 4 deletions
+1 -3
View File
@@ -32,9 +32,7 @@ type PVEProctype struct {
func NewClient(url string, token string, secret string) ProxmoxClient { func NewClient(url string, token string, secret string) ProxmoxClient {
HTTPClient := http.Client{ HTTPClient := http.Client{
Transport: &http.Transport{ Transport: &http.Transport{
TLSClientConfig: &tls.Config{ TLSClientConfig: &tls.Config{},
InsecureSkipVerify: true,
},
}, },
} }
+9 -1
View File
@@ -24,15 +24,23 @@ type Config struct {
} }
func GetConfig(configPath string) Config { func GetConfig(configPath string) Config {
content, err := os.ReadFile(configPath) root, err := os.OpenRoot(".")
if err != nil {
log.Fatal("Error when opening root dir: ", err)
}
defer root.Close()
content, err := root.ReadFile(configPath)
if err != nil { if err != nil {
log.Fatal("Error when opening config file: ", err) log.Fatal("Error when opening config file: ", err)
} }
var config Config var config Config
err = json.Unmarshal(content, &config) err = json.Unmarshal(content, &config)
if err != nil { if err != nil {
log.Fatal("Error during parsing config file: ", err) log.Fatal("Error during parsing config file: ", err)
} }
return config return config
} }