|
|
@ -311,8 +311,6 @@ func validateConfig(s config.Config) error { |
|
|
|
globalNotificationSys.ConfiguredTargetIDs()) |
|
|
|
globalNotificationSys.ConfiguredTargetIDs()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var syncEtcdOnce sync.Once |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func lookupConfigs(s config.Config) { |
|
|
|
func lookupConfigs(s config.Config) { |
|
|
|
ctx := GlobalContext |
|
|
|
ctx := GlobalContext |
|
|
|
|
|
|
|
|
|
|
@ -335,7 +333,6 @@ func lookupConfigs(s config.Config) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if etcdCfg.Enabled { |
|
|
|
if etcdCfg.Enabled { |
|
|
|
syncEtcdOnce.Do(func() { |
|
|
|
|
|
|
|
globalEtcdClient, err = etcd.New(etcdCfg) |
|
|
|
globalEtcdClient, err = etcd.New(etcdCfg) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
if globalIsGateway { |
|
|
|
if globalIsGateway { |
|
|
@ -344,16 +341,6 @@ func lookupConfigs(s config.Config) { |
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize etcd config: %w", err)) |
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize etcd config: %w", err)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Bucket federation is 'true' only when IAM assets are not namespaced
|
|
|
|
|
|
|
|
// per tenant and all tenants interested in globally available users
|
|
|
|
|
|
|
|
// if namespace was requested such as specifying etcdPathPrefix then
|
|
|
|
|
|
|
|
// we assume that users are interested in global bucket support
|
|
|
|
|
|
|
|
// but not federation.
|
|
|
|
|
|
|
|
globalBucketFederation = etcdCfg.PathPrefix == "" && etcdCfg.Enabled |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if len(globalDomainNames) != 0 && !globalDomainIPs.IsEmpty() && globalEtcdClient != nil { |
|
|
|
if len(globalDomainNames) != 0 && !globalDomainIPs.IsEmpty() && globalEtcdClient != nil { |
|
|
|
globalDNSConfig, err = dns.NewCoreDNS(etcdCfg.Config, |
|
|
|
globalDNSConfig, err = dns.NewCoreDNS(etcdCfg.Config, |
|
|
|
dns.DomainNames(globalDomainNames), |
|
|
|
dns.DomainNames(globalDomainNames), |
|
|
@ -362,10 +349,22 @@ func lookupConfigs(s config.Config) { |
|
|
|
dns.CoreDNSPath(etcdCfg.CoreDNSPath), |
|
|
|
dns.CoreDNSPath(etcdCfg.CoreDNSPath), |
|
|
|
) |
|
|
|
) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
if globalIsGateway { |
|
|
|
|
|
|
|
logger.FatalIf(err, "Unable to initialize DNS config") |
|
|
|
|
|
|
|
} else { |
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize DNS config for %s: %w", |
|
|
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize DNS config for %s: %w", |
|
|
|
globalDomainNames, err)) |
|
|
|
globalDomainNames, err)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Bucket federation is 'true' only when IAM assets are not namespaced
|
|
|
|
|
|
|
|
// per tenant and all tenants interested in globally available users
|
|
|
|
|
|
|
|
// if namespace was requested such as specifying etcdPathPrefix then
|
|
|
|
|
|
|
|
// we assume that users are interested in global bucket support
|
|
|
|
|
|
|
|
// but not federation.
|
|
|
|
|
|
|
|
globalBucketFederation = etcdCfg.PathPrefix == "" && etcdCfg.Enabled |
|
|
|
|
|
|
|
|
|
|
|
globalServerRegion, err = config.LookupRegion(s[config.RegionSubSys][config.Default]) |
|
|
|
globalServerRegion, err = config.LookupRegion(s[config.RegionSubSys][config.Default]) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
@ -571,6 +570,8 @@ func newServerConfig() config.Config { |
|
|
|
return config.New() |
|
|
|
return config.New() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var lookupConfigOnce sync.Once |
|
|
|
|
|
|
|
|
|
|
|
// newSrvConfig - initialize a new server config, saves env parameters if
|
|
|
|
// newSrvConfig - initialize a new server config, saves env parameters if
|
|
|
|
// found, otherwise use default parameters
|
|
|
|
// found, otherwise use default parameters
|
|
|
|
func newSrvConfig(objAPI ObjectLayer) error { |
|
|
|
func newSrvConfig(objAPI ObjectLayer) error { |
|
|
@ -578,7 +579,9 @@ func newSrvConfig(objAPI ObjectLayer) error { |
|
|
|
srvCfg := newServerConfig() |
|
|
|
srvCfg := newServerConfig() |
|
|
|
|
|
|
|
|
|
|
|
// Override any values from ENVs.
|
|
|
|
// Override any values from ENVs.
|
|
|
|
|
|
|
|
lookupConfigOnce.Do(func() { |
|
|
|
lookupConfigs(srvCfg) |
|
|
|
lookupConfigs(srvCfg) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// hold the mutex lock before a new config is assigned.
|
|
|
|
// hold the mutex lock before a new config is assigned.
|
|
|
|
globalServerConfigMu.Lock() |
|
|
|
globalServerConfigMu.Lock() |
|
|
@ -602,7 +605,9 @@ func loadConfig(objAPI ObjectLayer) error { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Override any values from ENVs.
|
|
|
|
// Override any values from ENVs.
|
|
|
|
|
|
|
|
lookupConfigOnce.Do(func() { |
|
|
|
lookupConfigs(srvCfg) |
|
|
|
lookupConfigs(srvCfg) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// hold the mutex lock before a new config is assigned.
|
|
|
|
// hold the mutex lock before a new config is assigned.
|
|
|
|
globalServerConfigMu.Lock() |
|
|
|
globalServerConfigMu.Lock() |
|
|
|