mirror of
https://github.com/prometheus-community/windows_exporter
synced 2024-12-24 23:42:08 +00:00
Merge pull request #1265 from DiniFarb/fix_configfile
fix: config file CLI argument for relative paths -> v0.23.1
This commit is contained in:
commit
b0a1a38829
@ -18,8 +18,8 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/go-kit/log"
|
||||
@ -40,11 +40,8 @@ type Resolver struct {
|
||||
func NewResolver(file string, logger log.Logger, insecure_skip_verify bool) (*Resolver, error) {
|
||||
flags := map[string]string{}
|
||||
var fileBytes []byte
|
||||
url, err := url.ParseRequestURI(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if url.Scheme == "http" || url.Scheme == "https" {
|
||||
var err error
|
||||
if strings.HasPrefix(file, "http://") || strings.HasPrefix(file, "https://") {
|
||||
_ = level.Info(logger).Log("msg", fmt.Sprintf("Loading configuration file from URL: %v", file))
|
||||
tr := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: insecure_skip_verify},
|
||||
|
Loading…
Reference in New Issue
Block a user