fix use_replication has no effect error

This commit is contained in:
siddontang 2015-02-14 14:38:13 +08:00
parent 1760e9fe20
commit 13767e1bb2
1 changed files with 11 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import (
"os" "os"
"os/signal" "os/signal"
"runtime" "runtime"
"strings"
"syscall" "syscall"
) )
@ -64,7 +65,16 @@ func main() {
cfg.UseReplication = true cfg.UseReplication = true
} else { } else {
cfg.Readonly = *readonly cfg.Readonly = *readonly
// if rpl in command flag, use it.
for _, arg := range os.Args {
arg := strings.ToLower(arg)
if arg == "-rpl" || arg == "-rpl=true" || arg == "-rpl=false" {
cfg.UseReplication = *rpl cfg.UseReplication = *rpl
break
}
}
cfg.Replication.Sync = *rplSync cfg.Replication.Sync = *rplSync
} }