diff --git a/pkg/plex/client.go b/pkg/plex/client.go index a63e8d8..77fd523 100644 --- a/pkg/plex/client.go +++ b/pkg/plex/client.go @@ -6,6 +6,8 @@ import ( "io" "net/http" "net/url" + "crypto/tls" + "os" ) var ErrNotFound = errors.New("not found") @@ -23,10 +25,19 @@ func NewClient(serverURL, token string) (*Client, error) { return nil, err } + skipTLSVerification := os.Getenv("SKIP_TLS_VERIFICATION") == "true" + + // Configure the HTTP client with optional TLS verification skip + httpClient := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: skipTLSVerification}, + }, + } + client := &Client{ Token: token, URL: parsed, - httpClient: http.Client{}, + httpClient: *httpClient, } return client, nil