mirror of
https://gitlab.com/psuapp/psu.git
synced 2025-07-25 04:42:26 +00:00
Enhance Portainer URL parsing in Client
This commit is contained in:
@ -10,6 +10,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
@ -282,7 +283,7 @@ func (n *PortainerClient) Clone() (c *PortainerClient, err error) {
|
|||||||
|
|
||||||
// Create a new client
|
// Create a new client
|
||||||
func NewClient(config ClientConfig) (c *PortainerClient, err error) {
|
func NewClient(config ClientConfig) (c *PortainerClient, err error) {
|
||||||
apiUrl, err := url.Parse(config.Url + "/api/")
|
apiUrl, err := url.Parse(strings.TrimRight(config.Url, "/") + "/api/")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user