|
|
@ -196,6 +196,15 @@ func StartGateway(ctx *cli.Context, gw Gateway) { |
|
|
|
// Add API router.
|
|
|
|
// Add API router.
|
|
|
|
registerAPIRouter(router) |
|
|
|
registerAPIRouter(router) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Dummy endpoint representing gateway instance.
|
|
|
|
|
|
|
|
globalEndpoints = []Endpoint{{ |
|
|
|
|
|
|
|
URL: &url.URL{Path: "/minio/gateway"}, |
|
|
|
|
|
|
|
IsLocal: true, |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize Admin Peers.
|
|
|
|
|
|
|
|
initGlobalAdminPeers(globalEndpoints) |
|
|
|
|
|
|
|
|
|
|
|
var getCert certs.GetCertificateFunc |
|
|
|
var getCert certs.GetCertificateFunc |
|
|
|
if globalTLSCerts != nil { |
|
|
|
if globalTLSCerts != nil { |
|
|
|
getCert = globalTLSCerts.GetCertificate |
|
|
|
getCert = globalTLSCerts.GetCertificate |
|
|
@ -221,20 +230,24 @@ func StartGateway(ctx *cli.Context, gw Gateway) { |
|
|
|
|
|
|
|
|
|
|
|
// Create a new config system.
|
|
|
|
// Create a new config system.
|
|
|
|
globalConfigSys = NewConfigSys() |
|
|
|
globalConfigSys = NewConfigSys() |
|
|
|
|
|
|
|
if globalEtcdClient != nil { |
|
|
|
// Initialize server config.
|
|
|
|
// Initialize server config.
|
|
|
|
srvCfg := newServerConfig() |
|
|
|
_ = globalConfigSys.Init(newObject) |
|
|
|
|
|
|
|
} else { |
|
|
|
// Override any values from ENVs.
|
|
|
|
// Initialize server config.
|
|
|
|
srvCfg.loadFromEnvs() |
|
|
|
srvCfg := newServerConfig() |
|
|
|
|
|
|
|
|
|
|
|
// Load values to cached global values.
|
|
|
|
// Override any values from ENVs.
|
|
|
|
srvCfg.loadToCachedConfigs() |
|
|
|
srvCfg.loadFromEnvs() |
|
|
|
|
|
|
|
|
|
|
|
// hold the mutex lock before a new config is assigned.
|
|
|
|
// Load values to cached global values.
|
|
|
|
globalServerConfigMu.Lock() |
|
|
|
srvCfg.loadToCachedConfigs() |
|
|
|
globalServerConfig = srvCfg |
|
|
|
|
|
|
|
globalServerConfigMu.Unlock() |
|
|
|
// hold the mutex lock before a new config is assigned.
|
|
|
|
|
|
|
|
globalServerConfigMu.Lock() |
|
|
|
|
|
|
|
globalServerConfig = srvCfg |
|
|
|
|
|
|
|
globalServerConfigMu.Unlock() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Load logger subsystem
|
|
|
|
// Load logger subsystem
|
|
|
|
loadLoggers() |
|
|
|
loadLoggers() |
|
|
@ -257,7 +270,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) { |
|
|
|
globalIAMSys = NewIAMSys() |
|
|
|
globalIAMSys = NewIAMSys() |
|
|
|
if globalEtcdClient != nil { |
|
|
|
if globalEtcdClient != nil { |
|
|
|
// Initialize IAM sys.
|
|
|
|
// Initialize IAM sys.
|
|
|
|
go globalIAMSys.Init(newObject) |
|
|
|
_ = globalIAMSys.Init(newObject) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Create new policy system.
|
|
|
|
// Create new policy system.
|
|
|
@ -268,6 +281,9 @@ func StartGateway(ctx *cli.Context, gw Gateway) { |
|
|
|
|
|
|
|
|
|
|
|
// Create new notification system.
|
|
|
|
// Create new notification system.
|
|
|
|
globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints) |
|
|
|
globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints) |
|
|
|
|
|
|
|
if globalEtcdClient != nil { |
|
|
|
|
|
|
|
_ = globalNotificationSys.Init(newObject) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Once endpoints are finalized, initialize the new object api.
|
|
|
|
// Once endpoints are finalized, initialize the new object api.
|
|
|
|
globalObjLayerMutex.Lock() |
|
|
|
globalObjLayerMutex.Lock() |
|
|
|