From c156b09619c992f45592a82126db984f3a6f3531 Mon Sep 17 00:00:00 2001 From: tynam Date: Fri, 24 Dec 2021 10:14:53 +0800 Subject: [PATCH] Update config.go https://github.com/yedf/dtm/issues/94 --- common/config.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/common/config.go b/common/config.go index f39eaa0..afc5852 100644 --- a/common/config.go +++ b/common/config.go @@ -102,10 +102,10 @@ func checkConfig() error { if Config.TimeoutToFail < Config.RetryInterval { return errors.New("TimeoutToFail should not be less than RetryInterval") } - if Config.Store.Driver == BoltDb { + switch Config.Store.Driver { + case BoltDb: return nil - } - if Config.Store.Driver == Mysql { + case Mysql: if Config.Store.Host == "" { return errors.New("Db host not valid ") } @@ -115,6 +115,13 @@ func checkConfig() error { if Config.Store.User == "" { return errors.New("Db user not valid ") } + case Redis: + if Config.Store.Host == "" { + return errors.New("Redis host not valid ") + } + if Config.Store.Port == 0 { + return errors.New("Redis port not valid ") + } } return nil }