mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
Rename client to cachedClient
This commit is contained in:
parent
64619fc90f
commit
a0d75c8df9
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
var client *PortainerClient
|
var cachedClient *PortainerClient
|
||||||
|
|
||||||
type ClientConfig struct {
|
type ClientConfig struct {
|
||||||
Url string
|
Url string
|
||||||
@ -305,14 +305,14 @@ func NewClient(config ClientConfig) (c *PortainerClient, err error) {
|
|||||||
|
|
||||||
// Get the cached client or a new one
|
// Get the cached client or a new one
|
||||||
func GetClient() (c *PortainerClient, err error) {
|
func GetClient() (c *PortainerClient, err error) {
|
||||||
if client == nil {
|
if cachedClient == nil {
|
||||||
client, err = NewClient(ClientConfig{
|
cachedClient, err = NewClient(ClientConfig{
|
||||||
Url: viper.GetString("url"),
|
Url: viper.GetString("url"),
|
||||||
User: viper.GetString("user"),
|
User: viper.GetString("user"),
|
||||||
Password: viper.GetString("password"),
|
Password: viper.GetString("password"),
|
||||||
Token: viper.GetString("auth-token"),
|
Token: viper.GetString("auth-token"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
c = client
|
c = cachedClient
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user