server: Introduce a new env MINIO_REGION. (#4078)

This is implemented to be able to override region
through command line just like how access and
secret keys are provided.
This commit is contained in:
Harshavardhana
2017-04-09 10:44:10 -07:00
committed by GitHub
parent 604417baf4
commit b927523223
5 changed files with 37 additions and 4 deletions
+10 -4
View File
@@ -138,10 +138,10 @@ func TestServerConfigWithEnvs(t *testing.T) {
os.Setenv("MINIO_SECRET_KEY", "minio123")
defer os.Unsetenv("MINIO_SECRET_KEY")
defer func() {
globalIsEnvBrowser = false
globalIsEnvCreds = false
}()
os.Setenv("MINIO_REGION", "us-west-1")
defer os.Unsetenv("MINIO_REGION")
defer resetGlobalIsEnvs()
// Get test root.
rootPath, err := getTestRoot()
@@ -165,6 +165,11 @@ func TestServerConfigWithEnvs(t *testing.T) {
t.Errorf("Expecting browser is set to false found %v", serverConfig.GetBrowser())
}
// Check if serverConfig has
if serverConfig.GetRegion() != "us-west-1" {
t.Errorf("Expecting region to be \"us-west-1\" found %v", serverConfig.GetRegion())
}
// Check if serverConfig has
cred := serverConfig.GetCredential()
@@ -175,6 +180,7 @@ func TestServerConfigWithEnvs(t *testing.T) {
if cred.SecretKey != "minio123" {
t.Errorf("Expecting access key to be `minio123` found %s", cred.SecretKey)
}
}
func TestCheckDupJSONKeys(t *testing.T) {