mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
avoid using os.Getenv for internal code, use env.Get() instead (#17688)
This commit is contained in:
@@ -27,7 +27,6 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -40,6 +39,7 @@ import (
|
||||
"github.com/minio/minio-go/v7/pkg/set"
|
||||
"github.com/minio/minio-go/v7/pkg/signer"
|
||||
"github.com/minio/minio/internal/auth"
|
||||
"github.com/minio/pkg/env"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -121,7 +121,7 @@ var iamTestSuites = func() []*TestSuiteIAM {
|
||||
}()
|
||||
|
||||
const (
|
||||
EnvTestEtcdBackend = "ETCD_SERVER"
|
||||
EnvTestEtcdBackend = "_MINIO_ETCD_TEST_SERVER"
|
||||
)
|
||||
|
||||
func (s *TestSuiteIAM) setUpEtcd(c *check, etcdServer string) {
|
||||
@@ -144,7 +144,7 @@ func (s *TestSuiteIAM) setUpEtcd(c *check, etcdServer string) {
|
||||
func (s *TestSuiteIAM) SetUpSuite(c *check) {
|
||||
// If etcd backend is specified and etcd server is not present, the test
|
||||
// is skipped.
|
||||
etcdServer := os.Getenv(EnvTestEtcdBackend)
|
||||
etcdServer := env.Get(EnvTestEtcdBackend, "")
|
||||
if s.withEtcdBackend && etcdServer == "" {
|
||||
c.Skip("Skipping etcd backend IAM test as no etcd server is configured.")
|
||||
}
|
||||
@@ -983,9 +983,9 @@ func (s *TestSuiteIAM) SetUpAccMgmtPlugin(c *check) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), testDefaultTimeout)
|
||||
defer cancel()
|
||||
|
||||
pluginEndpoint := os.Getenv("POLICY_PLUGIN_ENDPOINT")
|
||||
pluginEndpoint := env.Get("_MINIO_POLICY_PLUGIN_ENDPOINT", "")
|
||||
if pluginEndpoint == "" {
|
||||
c.Skip("POLICY_PLUGIN_ENDPOINT not given - skipping.")
|
||||
c.Skip("_MINIO_POLICY_PLUGIN_ENDPOINT not given - skipping.")
|
||||
}
|
||||
|
||||
configCmds := []string{
|
||||
|
||||
@@ -31,6 +31,7 @@ import (
|
||||
"github.com/minio/minio/internal/color"
|
||||
"github.com/minio/minio/internal/logger"
|
||||
"github.com/minio/pkg/console"
|
||||
"github.com/minio/pkg/env"
|
||||
"github.com/minio/pkg/trie"
|
||||
"github.com/minio/pkg/words"
|
||||
)
|
||||
@@ -191,7 +192,7 @@ func Main(args []string) {
|
||||
// Set the minio app name.
|
||||
appName := filepath.Base(args[0])
|
||||
|
||||
if os.Getenv("_MINIO_DEBUG_NO_EXIT") != "" {
|
||||
if env.Get("_MINIO_DEBUG_NO_EXIT", "") != "" {
|
||||
freeze := func(_ int) {
|
||||
// Infinite blocking op
|
||||
<-make(chan struct{})
|
||||
|
||||
@@ -660,7 +660,7 @@ func (s *TestSuiteIAM) SetUpLDAP(c *check, serverAddr string) {
|
||||
}
|
||||
|
||||
const (
|
||||
EnvTestLDAPServer = "LDAP_TEST_SERVER"
|
||||
EnvTestLDAPServer = "_MINIO_LDAP_TEST_SERVER"
|
||||
)
|
||||
|
||||
func TestIAMWithLDAPServerSuite(t *testing.T) {
|
||||
@@ -1379,8 +1379,8 @@ var testAppParams = OpenIDClientAppParams{
|
||||
}
|
||||
|
||||
const (
|
||||
EnvTestOpenIDServer = "OPENID_TEST_SERVER"
|
||||
EnvTestOpenIDServer2 = "OPENID_TEST_SERVER_2"
|
||||
EnvTestOpenIDServer = "_MINIO_OPENID_TEST_SERVER"
|
||||
EnvTestOpenIDServer2 = "_MINIO_OPENID_TEST_SERVER_2"
|
||||
)
|
||||
|
||||
// SetUpOpenIDs - sets up one or more OpenID test servers using the test OpenID
|
||||
|
||||
Reference in New Issue
Block a user