mirror of
https://github.com/minio/minio.git
synced 2025-11-10 22:10:12 -05:00
Move etcd, logger, crypto into their own packages (#8366)
- Deprecates _MINIO_PROFILER, `mc admin profile` does the job - Move ENVs to common location in cmd/config/
This commit is contained in:
committed by
kannappanr
parent
bffc378a4f
commit
290ad0996f
15
pkg/env/env.go
vendored
15
pkg/env/env.go
vendored
@@ -1,6 +1,9 @@
|
||||
package env
|
||||
|
||||
import "os"
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Get retrieves the value of the environment variable named
|
||||
// by the key. If the variable is present in the environment the
|
||||
@@ -19,3 +22,13 @@ func Get(key, defaultValue string) string {
|
||||
// Otherwise the returned value will be empty and the boolean will
|
||||
// be false.
|
||||
func Lookup(key string) (string, bool) { return os.LookupEnv(key) }
|
||||
|
||||
// List all envs with a given prefix.
|
||||
func List(prefix string) (envs []string) {
|
||||
for _, env := range os.Environ() {
|
||||
if strings.HasPrefix(env, prefix) {
|
||||
envs = append(envs, env)
|
||||
}
|
||||
}
|
||||
return envs
|
||||
}
|
||||
|
||||
@@ -179,9 +179,6 @@ func loadFileConfigEtcd(filename string, clnt *etcd.Client, v interface{}) error
|
||||
// decoder format according to the filename extension. If no
|
||||
// extension is provided, json will be selected by default.
|
||||
func loadFileConfig(filename string, v interface{}) error {
|
||||
if _, err := os.Stat(filename); err != nil {
|
||||
return err
|
||||
}
|
||||
fileData, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user