From 13767e1bb21f772d5f81be0af89c976b1b12630e Mon Sep 17 00:00:00 2001 From: siddontang Date: Sat, 14 Feb 2015 14:38:13 +0800 Subject: [PATCH] fix use_replication has no effect error --- cmd/ledis-server/main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/ledis-server/main.go b/cmd/ledis-server/main.go index e2f246a..594a046 100644 --- a/cmd/ledis-server/main.go +++ b/cmd/ledis-server/main.go @@ -11,6 +11,7 @@ import ( "os" "os/signal" "runtime" + "strings" "syscall" ) @@ -64,7 +65,16 @@ func main() { cfg.UseReplication = true } else { cfg.Readonly = *readonly - cfg.UseReplication = *rpl + + // 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 + break + } + } + cfg.Replication.Sync = *rplSync }