mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 22:39:18 +08:00
Formatting adjustments, script removal, and helm template rendering (#1389)
* cicd: robot automated Change * fix: add chat thmp * fix: fix openim test file Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim ctl system sctips remove Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim cicd images Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim cicd images Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim config ete code Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: fix openim pkg --------- Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> Co-authored-by: cubxxw <cubxxw@users.noreply.github.com>
This commit is contained in:
@@ -1 +0,0 @@
|
||||
.keep
|
||||
@@ -1,6 +1,9 @@
|
||||
package config
|
||||
|
||||
import "flag"
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Flags is the flag set that AddOptions adds to. Test authors should
|
||||
// also use it instead of directly adding to the global command line.
|
||||
@@ -19,3 +22,49 @@ func CopyFlags(source *flag.FlagSet, target *flag.FlagSet) {
|
||||
target.Var(flag.Value, flag.Name, flag.Usage)
|
||||
})
|
||||
}
|
||||
|
||||
// Config defines the configuration structure for the OpenIM components.
|
||||
type Config struct {
|
||||
APIHost string
|
||||
APIPort string
|
||||
MsgGatewayHost string
|
||||
MsgTransferHost string
|
||||
PushHost string
|
||||
RPCAuthHost string
|
||||
RPCConversationHost string
|
||||
RPCFriendHost string
|
||||
RPCGroupHost string
|
||||
RPCMsgHost string
|
||||
RPCThirdHost string
|
||||
RPCUserHost string
|
||||
// Add other configuration fields as needed
|
||||
}
|
||||
|
||||
// LoadConfig loads the configurations from environment variables or default values.
|
||||
func LoadConfig() *Config {
|
||||
return &Config{
|
||||
APIHost: getEnv("OPENIM_API_HOST", "127.0.0.1"),
|
||||
APIPort: getEnv("API_OPENIM_PORT", "10002"),
|
||||
|
||||
// TODO: Set default variable
|
||||
MsgGatewayHost: getEnv("OPENIM_MSGGATEWAY_HOST", "default-msggateway-host"),
|
||||
MsgTransferHost: getEnv("OPENIM_MSGTRANSFER_HOST", "default-msgtransfer-host"),
|
||||
PushHost: getEnv("OPENIM_PUSH_HOST", "default-push-host"),
|
||||
RPCAuthHost: getEnv("OPENIM_RPC_AUTH_HOST", "default-rpc-auth-host"),
|
||||
RPCConversationHost: getEnv("OPENIM_RPC_CONVERSATION_HOST", "default-rpc-conversation-host"),
|
||||
RPCFriendHost: getEnv("OPENIM_RPC_FRIEND_HOST", "default-rpc-friend-host"),
|
||||
RPCGroupHost: getEnv("OPENIM_RPC_GROUP_HOST", "default-rpc-group-host"),
|
||||
RPCMsgHost: getEnv("OPENIM_RPC_MSG_HOST", "default-rpc-msg-host"),
|
||||
RPCThirdHost: getEnv("OPENIM_RPC_THIRD_HOST", "default-rpc-third-host"),
|
||||
RPCUserHost: getEnv("OPENIM_RPC_USER_HOST", "default-rpc-user-host"),
|
||||
}
|
||||
}
|
||||
|
||||
// getEnv is a helper function to read an environment variable or return a default value.
|
||||
func getEnv(key, defaultValue string) string {
|
||||
value, exists := os.LookupEnv(key)
|
||||
if !exists {
|
||||
return defaultValue
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user