Skip to content

Commit 7ff009e

Browse files
authored
Add Insecure parameter to NewAdminClient function (#224)
When using the madmin client, for some operations such as health checks against a MinIO instnace with TLS we need a client with insecure turned on.
1 parent 3760c78 commit 7ff009e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

restapi/client-admin.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ import (
3333

3434
const globalAppName = "console"
3535

36-
// NewAdminClient gives a new client interface
36+
// NewAdminClient gives a new madmin client interface
3737
func NewAdminClient(url, accessKey, secretKey string) (*madmin.AdminClient, *probe.Error) {
38+
return NewAdminClientWithInsecure(url, accessKey, secretKey, false)
39+
}
40+
41+
// NewAdminClientWithInsecure gives a new madmin client interface either secure or insecure based on parameter
42+
func NewAdminClientWithInsecure(url, accessKey, secretKey string, insecure bool) (*madmin.AdminClient, *probe.Error) {
3843
appName := filepath.Base(globalAppName)
3944

4045
s3Client, err := s3AdminNew(&mcCmd.Config{
@@ -44,7 +49,7 @@ func NewAdminClient(url, accessKey, secretKey string) (*madmin.AdminClient, *pro
4449
AppName: appName,
4550
AppVersion: ConsoleVersion,
4651
AppComments: []string{appName, runtime.GOOS, runtime.GOARCH},
47-
Insecure: false,
52+
Insecure: insecure,
4853
})
4954
if err != nil {
5055
return nil, err.Trace(url)

0 commit comments

Comments
 (0)