Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix the zk don't start problem #328

Merged
merged 35 commits into from
Dec 18, 2023
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
01f7d4f
feat: add some api about admin
luhaoling Dec 12, 2023
c65ada3
fix: fix the conflect
luhaoling Dec 13, 2023
260101d
feat: add some api about admin
luhaoling Dec 13, 2023
5ba3e4c
fix: del the unuse method
luhaoling Dec 14, 2023
505a97e
fix: Optimized code
luhaoling Dec 14, 2023
5f5d8bf
fix: fix the userID
luhaoling Dec 14, 2023
0943083
Merge branch 'openimsdk:main' into main
luhaoling Dec 15, 2023
3e5aa69
fix: del the config code getting from zk
luhaoling Dec 15, 2023
37c6d6e
fix: fix the initRedis
luhaoling Dec 15, 2023
bf9ee0e
fix: add the get Evn method in Config
luhaoling Dec 15, 2023
3001392
Merge branch 'openimsdk:main' into main
luhaoling Dec 16, 2023
27550fd
fix: fix the config.yaml.template
luhaoling Dec 18, 2023
925c38f
Merge branch 'openimsdk:main' into env
luhaoling Dec 18, 2023
5a40661
fix: fix the env config
luhaoling Dec 18, 2023
2ec54f0
feat: add some conponent env
luhaoling Dec 18, 2023
b95e97d
Merge branch 'openimsdk:main' into env3
luhaoling Dec 18, 2023
c588e40
fix: add component config env
luhaoling Dec 18, 2023
4b37873
fix: fix the openIMURL
luhaoling Dec 18, 2023
6295454
fix: find the zk don't connect error
luhaoling Dec 18, 2023
6cdaa92
fix: find the zk error
luhaoling Dec 18, 2023
44be73e
fix: test the jz error
luhaoling Dec 18, 2023
33105b6
fix: delt the log
luhaoling Dec 18, 2023
499c888
fix: fix the component error
luhaoling Dec 18, 2023
eb5e025
fix: fix the error of get env location
luhaoling Dec 18, 2023
06ee4a6
fix: fix the error
luhaoling Dec 18, 2023
ce609b8
fix: fix the zk start error
luhaoling Dec 18, 2023
62cf650
fix: fix the Config
luhaoling Dec 18, 2023
7c7df60
fix: testing
luhaoling Dec 18, 2023
7281d02
fix: fix the config.Env error
luhaoling Dec 18, 2023
15f5476
fix: fix the componentCheck
luhaoling Dec 18, 2023
75c4133
fix: fix the config
luhaoling Dec 18, 2023
7f94eab
fix: find the error
luhaoling Dec 18, 2023
21a6ce3
fix: del the flag
luhaoling Dec 18, 2023
210660f
fix: fix the error
luhaoling Dec 18, 2023
60347c4
fix: fix the conflect
luhaoling Dec 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions pkg/common/config/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,16 @@ func InitConfig(configFile string) error {
if err := yaml.NewDecoder(bytes.NewReader(data)).Decode(&Config); err != nil {
return fmt.Errorf("parse loacl openIMConfig file error: %w", err)
}
if err != nil {
return utils.Wrap(err, configFile)
}

if err := configGetEnv(); err != nil {
return fmt.Errorf("get env error:%w", err)
}

configData, err := yaml.Marshal(&Config)
fmt.Printf("debug: %s\nconfig:\n%s\n", time.Now(), string(configData))
if err != nil {
return utils.Wrap(err, configFile)
}
fmt.Printf("%s\nconfig:\n%s\n", time.Now(), string(configData))

return nil
}
Expand Down Expand Up @@ -226,7 +225,6 @@ func configGetEnv() error {
Config.Zookeeper.Schema = getEnv("ZOOKEEPER_SCHEMA", Config.Zookeeper.Schema)
Config.Zookeeper.Username = getEnv("ZOOKEEPER_USERNAME", Config.Zookeeper.Username)
Config.Zookeeper.Password = getEnv("ZOOKEEPER_PASSWORD", Config.Zookeeper.Password)
Config.Zookeeper.ZkAddr = getArrEnv("ZOOKEEPER_ADDRESS", "ZOOKEEPER_PORT", Config.Zookeeper.ZkAddr)

Config.ChatApi.ListenIP = getEnv("CHAT_API_LISTEN_IP", Config.ChatApi.ListenIP)
Config.AdminApi.ListenIP = getEnv("ADMIN_API_LISTEN_IP", Config.AdminApi.ListenIP)
Expand All @@ -253,18 +251,21 @@ func configGetEnv() error {
if err != nil {
return err
}

getArrEnv("ZOOKEEPER_ADDRESS", "ZOOKEEPER_PORT", Config.Zookeeper.ZkAddr)
return nil
}

func getArrEnv(key1, key2 string, fallback []string) []string {
func getArrEnv(key1, key2 string, fallback []string) {
str1 := getEnv(key1, "")
str2 := getEnv(key2, "")
str := fmt.Sprintf("%s:%s", str1, str2)
arr := make([]string, 1)
if len(str) <= 1 {
return fallback
return
}
return []string{str}
arr[0] = str
fmt.Println("zookeeper Envirement valiable", "str", str)
Config.Zookeeper.ZkAddr = arr
}

func getArrPointEnv(key1, key2 string, fallback *[]string) *[]string {
Expand Down
Loading