diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2021-03-12 15:05:31 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-12 15:05:31 +0800 |
| commit | 17d02264f33f501e124060ade7b0b39e687aaa3d (patch) | |
| tree | 0b80a2d7bc9fd99d7b68e8c06080a9a062fffd35 /weed/command/filer_replication.go | |
| parent | 620b91f23eaf5718088dc9ddcf91540967d0c8a6 (diff) | |
| parent | 5f99eee27c0f48ebc10e79241650be3727124af2 (diff) | |
| download | seaweedfs-17d02264f33f501e124060ade7b0b39e687aaa3d.tar.xz seaweedfs-17d02264f33f501e124060ade7b0b39e687aaa3d.zip | |
Merge pull request #74 from chrislusf/master
sync
Diffstat (limited to 'weed/command/filer_replication.go')
| -rw-r--r-- | weed/command/filer_replication.go | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/weed/command/filer_replication.go b/weed/command/filer_replication.go index e8c06b208..885c95540 100644 --- a/weed/command/filer_replication.go +++ b/weed/command/filer_replication.go @@ -74,18 +74,7 @@ func runFilerReplicate(cmd *Command, args []string) bool { } } - var dataSink sink.ReplicationSink - for _, sk := range sink.Sinks { - if config.GetBool("sink." + sk.GetName() + ".enabled") { - if err := sk.Initialize(config, "sink."+sk.GetName()+"."); err != nil { - glog.Fatalf("Failed to initialize sink for %s: %+v", - sk.GetName(), err) - } - glog.V(0).Infof("Configure sink to %s", sk.GetName()) - dataSink = sk - break - } - } + dataSink := findSink(config) if dataSink == nil { println("no data sink configured in replication.toml:") @@ -135,6 +124,22 @@ func runFilerReplicate(cmd *Command, args []string) bool { } +func findSink(config *util.ViperProxy) sink.ReplicationSink { + var dataSink sink.ReplicationSink + for _, sk := range sink.Sinks { + if config.GetBool("sink." + sk.GetName() + ".enabled") { + if err := sk.Initialize(config, "sink."+sk.GetName()+"."); err != nil { + glog.Fatalf("Failed to initialize sink for %s: %+v", + sk.GetName(), err) + } + glog.V(0).Infof("Configure sink to %s", sk.GetName()) + dataSink = sk + break + } + } + return dataSink +} + func validateOneEnabledInput(config *util.ViperProxy) { enabledInput := "" for _, input := range sub.NotificationInputs { |
