From e8618aa6580f1175891362d7c000ce323c7a012c Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 06:54:23 +0000 Subject: [PATCH 1/8] feat: Updated pkg/common/config/im.go --- pkg/common/config/im.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/common/config/im.go b/pkg/common/config/im.go index 6751d8b83..ecbd2b1c5 100644 --- a/pkg/common/config/im.go +++ b/pkg/common/config/im.go @@ -14,7 +14,8 @@ package config -var imConfig struct { +func init() { + var imConfig struct { Mysql struct { Address []string `yaml:"address"` Username string `yaml:"username"` From 8ce7a55a5dae0ad55bd7c3ddda1931911b5fc9c6 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 07:13:17 +0000 Subject: [PATCH 2/8] feat: Updated pkg/common/config/im.go --- pkg/common/config/im.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/common/config/im.go b/pkg/common/config/im.go index ecbd2b1c5..34ca36486 100644 --- a/pkg/common/config/im.go +++ b/pkg/common/config/im.go @@ -15,6 +15,7 @@ package config func init() { + func init() { var imConfig struct { Mysql struct { Address []string `yaml:"address"` From b21069fd731e1e4090a1324b19cb6c2776b75b29 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 07:14:21 +0000 Subject: [PATCH 3/8] feat: Updated pkg/common/config/parse.go --- pkg/common/config/parse.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/common/config/parse.go b/pkg/common/config/parse.go index a5f38e341..5198c8882 100644 --- a/pkg/common/config/parse.go +++ b/pkg/common/config/parse.go @@ -35,7 +35,11 @@ var ( Root = filepath.Join(filepath.Dir(b), "../../..") ) -func readConfig(configFile string) ([]byte, error) { +// Added variable declarations inside the function body +func InitConfig(configFile string) error { + _, b, _, _ := runtime.Caller(0) + // Root folder of this project. + Root := filepath.Join(filepath.Dir(b), "../../..") b, err := os.ReadFile(configFile) if err != nil { return nil, utils.Wrap(err, configFile) From fca5d298f45bfd7fb16eb256c442a13b8bf8c50b Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 07:16:44 +0000 Subject: [PATCH 4/8] feat: Updated cmd/api/admin-api/main.go --- cmd/api/admin-api/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/api/admin-api/main.go b/cmd/api/admin-api/main.go index e9cb6baba..6fe354475 100644 --- a/cmd/api/admin-api/main.go +++ b/cmd/api/admin-api/main.go @@ -25,7 +25,7 @@ import ( mw2 "github.com/OpenIMSDK/chat/pkg/common/mw" "github.com/OpenIMSDK/chat/internal/api" - "github.com/OpenIMSDK/chat/pkg/common/config" + "github.com/OpenIMSDK/chat/pkg/common/config_fixed" openKeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper" "github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/mw" From f0959e085bb88c1270d9e8f944c69cb16bb93578 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 07:19:18 +0000 Subject: [PATCH 5/8] feat: Updated cmd/api/chat-api/main.go --- cmd/api/chat-api/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/api/chat-api/main.go b/cmd/api/chat-api/main.go index c26d54128..6e33bb49f 100644 --- a/cmd/api/chat-api/main.go +++ b/cmd/api/chat-api/main.go @@ -26,7 +26,7 @@ import ( mw2 "github.com/OpenIMSDK/chat/pkg/common/mw" "github.com/OpenIMSDK/chat/internal/api" - "github.com/OpenIMSDK/chat/pkg/common/config" + "github.com/OpenIMSDK/chat/pkg/common/config_fixed" openKeeper "github.com/OpenIMSDK/tools/discoveryregistry/zookeeper" "github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/mw" From ecc30e0abb6c678dcfbe62f0f95d4ddbf445d74a Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 07:21:49 +0000 Subject: [PATCH 6/8] feat: Updated cmd/rpc/admin-rpc/main.go --- cmd/rpc/admin-rpc/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/rpc/admin-rpc/main.go b/cmd/rpc/admin-rpc/main.go index 32391f3ed..504fa81ef 100644 --- a/cmd/rpc/admin-rpc/main.go +++ b/cmd/rpc/admin-rpc/main.go @@ -23,7 +23,7 @@ import ( "time" "github.com/OpenIMSDK/chat/internal/rpc/admin" - "github.com/OpenIMSDK/chat/pkg/common/config" + "github.com/OpenIMSDK/chat/pkg/common/config_fixed" ) func main() { From a0ef4ed7e38a664af4c89f095710657ab6db1930 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 07:24:54 +0000 Subject: [PATCH 7/8] feat: Updated cmd/rpc/chat-rpc/main.go --- cmd/rpc/chat-rpc/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/rpc/chat-rpc/main.go b/cmd/rpc/chat-rpc/main.go index 50de20a67..2da70ba3e 100644 --- a/cmd/rpc/chat-rpc/main.go +++ b/cmd/rpc/chat-rpc/main.go @@ -23,7 +23,7 @@ import ( "time" "github.com/OpenIMSDK/chat/internal/rpc/chat" - "github.com/OpenIMSDK/chat/pkg/common/config" + "github.com/OpenIMSDK/chat/pkg/common/config_fixed" ) func main() { From 897169a58d892bd76707a8d0723dd78a6af26002 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 19 Oct 2023 07:27:56 +0000 Subject: [PATCH 8/8] feat: Updated tools/component/component.go --- tools/component/component.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/component/component.go b/tools/component/component.go index 3f28862f5..7b76c0ee0 100644 --- a/tools/component/component.go +++ b/tools/component/component.go @@ -2,7 +2,7 @@ package component import ( "fmt" - "github.com/OpenIMSDK/chat/pkg/common/config" + "github.com/OpenIMSDK/chat/pkg/common/config_fixed" "github.com/OpenIMSDK/protocol/constant" "github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/log"