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
+12
View File
@@ -170,6 +170,10 @@ func newConfig() error {
srvCfg.SetBrowser(globalIsBrowserEnabled)
}
if globalIsEnvRegion {
srvCfg.SetRegion(globalServerRegion)
}
// hold the mutex lock before a new config is assigned.
// Save the new config globally.
// unlock the mutex.
@@ -295,10 +299,15 @@ func loadConfig() error {
if globalIsEnvCreds {
srvCfg.SetCredential(globalActiveCred)
}
if globalIsEnvBrowser {
srvCfg.SetBrowser(globalIsBrowserEnabled)
}
if globalIsEnvRegion {
srvCfg.SetRegion(globalServerRegion)
}
// hold the mutex lock before a new config is assigned.
serverConfigMu.Lock()
serverConfig = srvCfg
@@ -308,6 +317,9 @@ func loadConfig() error {
if !globalIsEnvBrowser {
globalIsBrowserEnabled = serverConfig.GetBrowser()
}
if !globalIsEnvRegion {
globalServerRegion = serverConfig.GetRegion()
}
serverConfigMu.Unlock()
return nil