aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_replication.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-12-06 00:44:41 -0800
committerChris Lu <chris.lu@gmail.com>2018-12-06 00:44:41 -0800
commitc28e8a23972949fa8aefd018502885a115f5e51a (patch)
tree2870de43786ec61dfc4165ce49089498f256c01f /weed/command/filer_replication.go
parentffa2827ab162b37b75349dda7e73bf873ae1fdca (diff)
downloadseaweedfs-c28e8a23972949fa8aefd018502885a115f5e51a.tar.xz
seaweedfs-c28e8a23972949fa8aefd018502885a115f5e51a.zip
refactoring
Diffstat (limited to 'weed/command/filer_replication.go')
-rw-r--r--weed/command/filer_replication.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/weed/command/filer_replication.go b/weed/command/filer_replication.go
index 087a12059..3384e4023 100644
--- a/weed/command/filer_replication.go
+++ b/weed/command/filer_replication.go
@@ -41,16 +41,7 @@ func runFilerReplicate(cmd *Command, args []string) bool {
var notificationInput sub.NotificationInput
- enabledInput := ""
- for _, input := range sub.NotificationInputs {
- if config.GetBool("notification." + input.GetName() + ".enabled") {
- if enabledInput == "" {
- enabledInput = input.GetName()
- } else {
- glog.Fatalf("Notification input is enabled for both %s and %s", enabledInput, input.GetName())
- }
- }
- }
+ validateOneEnabledInput(config)
for _, input := range sub.NotificationInputs {
if config.GetBool("notification." + input.GetName() + ".enabled") {
@@ -133,3 +124,16 @@ func runFilerReplicate(cmd *Command, args []string) bool {
return true
}
+
+func validateOneEnabledInput(config *viper.Viper) {
+ enabledInput := ""
+ for _, input := range sub.NotificationInputs {
+ if config.GetBool("notification." + input.GetName() + ".enabled") {
+ if enabledInput == "" {
+ enabledInput = input.GetName()
+ } else {
+ glog.Fatalf("Notification input is enabled for both %s and %s", enabledInput, input.GetName())
+ }
+ }
+ }
+}