feat: add kafka and redis mongo env

Signed-off-by: Xinwei Xiong (cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
Xinwei Xiong (cubxxw)
2023-12-13 23:20:58 +08:00
parent f480f52e2d
commit d8838ee6b8
2 changed files with 97 additions and 65 deletions
+11
View File
@@ -15,6 +15,8 @@
package kafka
import (
"os"
"github.com/IBM/sarama"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
@@ -33,3 +35,12 @@ func SetupTLSConfig(cfg *sarama.Config) {
)
}
}
// getEnvOrConfig returns the value of the environment variable if it exists,
// otherwise, it returns the value from the configuration file.
func getEnvOrConfig(envName string, configValue string) string {
if value, exists := os.LookupEnv(envName); exists {
return value
}
return configValue
}