mirror of
https://github.com/minio/minio.git
synced 2025-11-26 04:26:12 -05:00
Support looking up environment remotely (#10215)
adds a feature where we can fetch the MinIO command-line remotely, this is primarily meant to add some stateless nature to the MinIO deployment in k8s environments, MinIO operator would run a webhook service endpoint which can be used to fetch any environment value in a generalized approach.
This commit is contained in:
7
pkg/env/env.go
vendored
7
pkg/env/env.go
vendored
@@ -18,7 +18,6 @@
|
||||
package env
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
@@ -46,7 +45,7 @@ func SetEnvOn() {
|
||||
|
||||
// IsSet returns if the given env key is set.
|
||||
func IsSet(key string) bool {
|
||||
_, ok := os.LookupEnv(key)
|
||||
_, ok := LookupEnv(key)
|
||||
return ok
|
||||
}
|
||||
|
||||
@@ -61,7 +60,7 @@ func Get(key, defaultValue string) string {
|
||||
if ok {
|
||||
return defaultValue
|
||||
}
|
||||
if v, ok := os.LookupEnv(key); ok {
|
||||
if v, ok := LookupEnv(key); ok {
|
||||
return v
|
||||
}
|
||||
return defaultValue
|
||||
@@ -69,7 +68,7 @@ func Get(key, defaultValue string) string {
|
||||
|
||||
// List all envs with a given prefix.
|
||||
func List(prefix string) (envs []string) {
|
||||
for _, env := range os.Environ() {
|
||||
for _, env := range Environ() {
|
||||
if strings.HasPrefix(env, prefix) {
|
||||
values := strings.SplitN(env, "=", 2)
|
||||
if len(values) == 2 {
|
||||
|
||||
Reference in New Issue
Block a user