mirror of
https://github.com/minio/minio.git
synced 2024-12-25 14:45:54 -05:00
allow loading some from config and some values from ENVs (#9872)
A regression perhaps introduced in #9851
This commit is contained in:
parent
85a1956e5c
commit
fa13fe2184
@ -333,15 +333,18 @@ func lookupConfigs(s config.Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if etcdCfg.Enabled {
|
if etcdCfg.Enabled {
|
||||||
globalEtcdClient, err = etcd.New(etcdCfg)
|
if globalEtcdClient == nil {
|
||||||
if err != nil {
|
globalEtcdClient, err = etcd.New(etcdCfg)
|
||||||
if globalIsGateway {
|
if err != nil {
|
||||||
logger.FatalIf(err, "Unable to initialize etcd config")
|
if globalIsGateway {
|
||||||
} else {
|
logger.FatalIf(err, "Unable to initialize etcd config")
|
||||||
logger.LogIf(ctx, fmt.Errorf("Unable to initialize etcd config: %w", err))
|
} else {
|
||||||
|
logger.LogIf(ctx, fmt.Errorf("Unable to initialize etcd config: %w", err))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(globalDomainNames) != 0 && !globalDomainIPs.IsEmpty() && globalEtcdClient != nil {
|
|
||||||
|
if len(globalDomainNames) != 0 && !globalDomainIPs.IsEmpty() && globalEtcdClient != nil && globalDNSConfig == nil {
|
||||||
globalDNSConfig, err = dns.NewCoreDNS(etcdCfg.Config,
|
globalDNSConfig, err = dns.NewCoreDNS(etcdCfg.Config,
|
||||||
dns.DomainNames(globalDomainNames),
|
dns.DomainNames(globalDomainNames),
|
||||||
dns.DomainIPs(globalDomainIPs),
|
dns.DomainIPs(globalDomainIPs),
|
||||||
@ -570,8 +573,6 @@ 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 {
|
||||||
@ -579,9 +580,7 @@ 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()
|
||||||
@ -605,9 +604,7 @@ 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()
|
||||||
|
@ -47,6 +47,11 @@ func newCoreDNSMsg(ip string, port string, ttl uint32, t time.Time) ([]byte, err
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Close closes the internal etcd client and cannot be used further
|
||||||
|
func (c *CoreDNS) Close() {
|
||||||
|
c.etcdClient.Close()
|
||||||
|
}
|
||||||
|
|
||||||
// List - Retrieves list of DNS entries for the domain.
|
// List - Retrieves list of DNS entries for the domain.
|
||||||
func (c *CoreDNS) List() (map[string][]SrvRecord, error) {
|
func (c *CoreDNS) List() (map[string][]SrvRecord, error) {
|
||||||
var srvRecords = map[string][]SrvRecord{}
|
var srvRecords = map[string][]SrvRecord{}
|
||||||
|
@ -162,9 +162,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
|
|||||||
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user