From 30a09a8683602ff5d43d2b00576170044a93d544 Mon Sep 17 00:00:00 2001 From: suxb201 Date: Thu, 18 Aug 2022 11:42:14 +0800 Subject: [PATCH] add default config --- internal/config/config.go | 23 +++++++++++++++++++++-- redis-shake.toml | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 78e26ae..4dfbd83 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -56,9 +56,25 @@ type tomlShakeConfig struct { var Config tomlShakeConfig -func LoadFromFile(filename string) { +func init() { + // source + Config.Source.Type = "sync" + Config.Source.Address = "" + Config.Source.Username = "" + Config.Source.Password = "" + Config.Source.IsTLS = false + Config.Source.ElastiCachePSync = "" + + // target + Config.Target.Type = "standalone" + Config.Target.Address = "" + Config.Target.Username = "" + Config.Target.Password = "" + Config.Target.IsTLS = false + + // advanced Config.Advanced.Dir = "data" - Config.Advanced.Ncpu = 3 + Config.Advanced.Ncpu = 4 Config.Advanced.PprofPort = 0 Config.Advanced.LogFile = "redis-shake.log" Config.Advanced.LogLevel = "info" @@ -67,6 +83,9 @@ func LoadFromFile(filename string) { Config.Advanced.PipelineCountLimit = 1024 Config.Advanced.TargetRedisClientMaxQuerybufLen = 1024 * 1000 * 1000 Config.Advanced.TargetRedisProtoMaxBulkLen = 512 * 1000 * 1000 +} + +func LoadFromFile(filename string) { buf, err := ioutil.ReadFile(filename) if err != nil { diff --git a/redis-shake.toml b/redis-shake.toml index ddc5b7b..996bc1d 100644 --- a/redis-shake.toml +++ b/redis-shake.toml @@ -19,7 +19,7 @@ tls = false dir = "data" # runtime.GOMAXPROCS, 0 means use runtime.NumCPU() cpu cores -ncpu = 3 +ncpu = 4 # pprof port, 0 means disable pprof_port = 0