config: setter/getter for Notifier and Logger into its own struct. (#3721)

This is an attempt cleanup code and keep the top level config
functions simpler and easy to understand where as move the
notifier related code and logger setter/getter methods as part
of their own struct.

Locks are now held properly not globally by configMutex, but
instead as private variables.

Final fix for #3700
This commit is contained in:
Harshavardhana
2017-02-09 15:20:54 -08:00
committed by GitHub
parent f38222c0cc
commit 1b4bb94ac4
20 changed files with 338 additions and 256 deletions

View File

@@ -531,7 +531,7 @@ func loadAllBucketNotifications(objAPI ObjectLayer) (map[string]*notificationCon
func loadAllQueueTargets() (map[string]*logrus.Logger, error) {
queueTargets := make(map[string]*logrus.Logger)
// Load all amqp targets, initialize their respective loggers.
for accountID, amqpN := range serverConfig.GetAMQP() {
for accountID, amqpN := range serverConfig.Notify.GetAMQP() {
if !amqpN.Enable {
continue
}
@@ -558,7 +558,7 @@ func loadAllQueueTargets() (map[string]*logrus.Logger, error) {
queueTargets[queueARN] = amqpLog
}
// Load all nats targets, initialize their respective loggers.
for accountID, natsN := range serverConfig.GetNATS() {
for accountID, natsN := range serverConfig.Notify.GetNATS() {
if !natsN.Enable {
continue
}
@@ -586,7 +586,7 @@ func loadAllQueueTargets() (map[string]*logrus.Logger, error) {
}
// Load redis targets, initialize their respective loggers.
for accountID, redisN := range serverConfig.GetRedis() {
for accountID, redisN := range serverConfig.Notify.GetRedis() {
if !redisN.Enable {
continue
}
@@ -614,7 +614,7 @@ func loadAllQueueTargets() (map[string]*logrus.Logger, error) {
}
// Load Webhook targets, initialize their respective loggers.
for accountID, webhookN := range serverConfig.GetWebhook() {
for accountID, webhookN := range serverConfig.Notify.GetWebhook() {
if !webhookN.Enable {
continue
}
@@ -635,7 +635,7 @@ func loadAllQueueTargets() (map[string]*logrus.Logger, error) {
}
// Load elastic targets, initialize their respective loggers.
for accountID, elasticN := range serverConfig.GetElasticSearch() {
for accountID, elasticN := range serverConfig.Notify.GetElasticSearch() {
if !elasticN.Enable {
continue
}
@@ -661,7 +661,7 @@ func loadAllQueueTargets() (map[string]*logrus.Logger, error) {
}
// Load PostgreSQL targets, initialize their respective loggers.
for accountID, pgN := range serverConfig.GetPostgreSQL() {
for accountID, pgN := range serverConfig.Notify.GetPostgreSQL() {
if !pgN.Enable {
continue
}
@@ -686,7 +686,7 @@ func loadAllQueueTargets() (map[string]*logrus.Logger, error) {
queueTargets[queueARN] = pgLog
}
// Load Kafka targets, initialize their respective loggers.
for accountID, kafkaN := range serverConfig.GetKafka() {
for accountID, kafkaN := range serverConfig.Notify.GetKafka() {
if !kafkaN.Enable {
continue
}