diff --git a/cmd/common-main.go b/cmd/common-main.go index 1967bbb37..60b81fcbf 100644 --- a/cmd/common-main.go +++ b/cmd/common-main.go @@ -213,6 +213,9 @@ func minioConfigToConsoleFeatures() { if globalSubnetConfig.APIKey != "" { os.Setenv("CONSOLE_SUBNET_API_KEY", globalSubnetConfig.APIKey) } + if globalSubnetConfig.Proxy != "" { + os.Setenv("CONSOLE_SUBNET_PROXY", globalSubnetConfig.Proxy) + } } func initConsoleServer() (*restapi.Server, error) { diff --git a/cmd/config-current.go b/cmd/config-current.go index 0790b22db..d035d8c9d 100644 --- a/cmd/config-current.go +++ b/cmd/config-current.go @@ -361,6 +361,10 @@ func validateConfig(s config.Config) error { return err } + if _, err = subnet.LookupConfig(s[config.SubnetSubSys][config.Default]); err != nil { + return err + } + return notify.TestNotificationTargets(GlobalContext, s, NewGatewayHTTPTransport(), globalNotificationSys.ConfiguredTargetIDs()) } diff --git a/internal/config/config.go b/internal/config/config.go index 225c6ae97..6e3c9a684 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -62,6 +62,7 @@ const ( SecretKey = "secret_key" License = "license" // Deprecated Dec 2021 APIKey = "api_key" + Proxy = "proxy" ) // Top level config constants. diff --git a/internal/config/constants.go b/internal/config/constants.go index af06452f9..94a97dd7f 100644 --- a/internal/config/constants.go +++ b/internal/config/constants.go @@ -55,6 +55,7 @@ const ( EnvMinIOSubnetLicense = "MINIO_SUBNET_LICENSE" // Deprecated Dec 2021 EnvMinIOSubnetAPIKey = "MINIO_SUBNET_API_KEY" + EnvMinIOSubnetProxy = "MINIO_SUBNET_PROXY" EnvMinIOServerURL = "MINIO_SERVER_URL" EnvMinIOBrowserRedirectURL = "MINIO_BROWSER_REDIRECT_URL" EnvRootDiskThresholdSize = "MINIO_ROOTDISK_THRESHOLD_SIZE" diff --git a/internal/config/subnet/api-key.go b/internal/config/subnet/api-key.go index 5ea24a4ea..4a6cef309 100644 --- a/internal/config/subnet/api-key.go +++ b/internal/config/subnet/api-key.go @@ -18,6 +18,8 @@ package subnet import ( + "net/url" + "github.com/minio/minio/internal/config" "github.com/minio/pkg/env" ) @@ -33,6 +35,10 @@ var ( Key: config.APIKey, Value: "", }, + config.KV{ + Key: config.Proxy, + Value: "", + }, } // HelpSubnet - provides help for subnet api key config @@ -49,6 +55,12 @@ var ( Description: "Subnet api key for the cluster", Optional: true, }, + config.HelpKV{ + Key: config.Proxy, + Type: "string", + Description: "HTTP(S) proxy URL to use for connecting to SUBNET", + Optional: true, + }, } ) @@ -59,6 +71,9 @@ type Config struct { // The subnet api key APIKey string `json:"api_key"` + + // The HTTP(S) proxy URL to use for connecting to SUBNET + Proxy string `json:"proxy"` } // LookupConfig - lookup config and override with valid environment settings if any. @@ -67,6 +82,12 @@ func LookupConfig(kvs config.KVS) (cfg Config, err error) { return cfg, err } + cfg.Proxy = env.Get(config.EnvMinIOSubnetProxy, kvs.Get(config.Proxy)) + _, err = url.Parse(cfg.Proxy) + if err != nil { + return cfg, err + } + cfg.License = env.Get(config.EnvMinIOSubnetLicense, kvs.Get(config.License)) cfg.APIKey = env.Get(config.EnvMinIOSubnetAPIKey, kvs.Get(config.APIKey))