mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Add subnet proxy config (#14225)
Will store the HTTP(S) proxy URL to use for connecting to SUBNET.
This commit is contained in:
parent
77b780b8ca
commit
3882da6ac5
@ -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) {
|
||||
|
@ -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())
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ const (
|
||||
SecretKey = "secret_key"
|
||||
License = "license" // Deprecated Dec 2021
|
||||
APIKey = "api_key"
|
||||
Proxy = "proxy"
|
||||
)
|
||||
|
||||
// Top level config constants.
|
||||
|
@ -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"
|
||||
|
@ -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))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user