config path

test-errcode
wangchuxiao 2 years ago
parent 8bdf86172f
commit a26ca657fe

@ -18,8 +18,9 @@ func main() {
router := api.NewGinRouter()
go third.MinioInit()
ginPort := flag.Int("port", config.Config.Api.GinPort[0], "get ginServerPort from cmd,default 10002 as port")
configPath := flag.String("config_path", "../config/", "config folder")
flag.Parse()
config.InitConfig()
config.InitConfig(*configPath)
address := "0.0.0.0:" + strconv.Itoa(*ginPort)
if config.Config.Api.ListenIP != "" {
address = config.Config.Api.ListenIP + ":" + strconv.Itoa(*ginPort)
@ -31,3 +32,7 @@ func main() {
panic("api start failed " + err.Error())
}
}
func T() {
}

@ -2,6 +2,7 @@ package main
import (
"OpenIM/internal/task"
"OpenIM/pkg/common/config"
"flag"
"fmt"
"time"
@ -11,7 +12,9 @@ func main() {
var userID = flag.String("user_id", "", "userID to clear msg and reset seq")
var superGroupID = flag.String("super_group_id", "", "superGroupID to clear msg and reset seq")
var fixAllSeq = flag.Bool("fix_all_seq", false, "fix seq")
var configPath = flag.String("config_path", "../config/", "config folder")
flag.Parse()
config.InitConfig(*configPath)
fmt.Println(time.Now(), "start cronTask", *userID, *superGroupID)
task.FixSeq(*userID, *superGroupID, *fixAllSeq)
}

@ -2,12 +2,17 @@ package main
import (
"OpenIM/internal/task"
"OpenIM/pkg/common/config"
"flag"
"fmt"
"time"
)
func main() {
fmt.Println(time.Now(), "start cronTask")
var configPath = flag.String("config_path", "../config/", "config folder")
flag.Parse()
config.InitConfig(*configPath)
if err := task.StartCronTask(); err != nil {
panic(err.Error())
}

@ -18,7 +18,9 @@ func main() {
rpcPort := flag.Int("rpc_port", defaultRpcPorts[0], "rpc listening port")
wsPort := flag.Int("ws_port", defaultWsPorts[0], "ws listening port")
prometheusPort := flag.Int("prometheus_port", defaultPromePorts[0], "PushrometheusPort default listen port")
configPath := flag.String("config_path", "../config/", "config folder")
flag.Parse()
config.InitConfig(*configPath)
var wg sync.WaitGroup
wg.Add(1)
fmt.Println("start rpc/msg_gateway server, port: ", *rpcPort, *wsPort, *prometheusPort, ", OpenIM version: ", constant.CurrentVersion, "\n")

@ -14,7 +14,9 @@ func main() {
var wg sync.WaitGroup
wg.Add(1)
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "MessageTransferPrometheusPort default listen port")
configPath := flag.String("config_path", "../config/", "config folder")
flag.Parse()
config.InitConfig(*configPath)
log.NewPrivateLog(constant.LogFileName)
msgTransfer := msgtransfer.NewMsgTransfer()
fmt.Println("start msg_transfer server ", ", OpenIM version: ", constant.CurrentVersion, "\n")

@ -14,7 +14,9 @@ func main() {
defaultPorts := config.Config.RpcPort.OpenImPushPort
rpcPort := flag.Int("port", defaultPorts[0], "rpc listening port")
prometheusPort := flag.Int("prometheus_port", config.Config.Prometheus.MessageTransferPrometheusPort[0], "PushrometheusPort default listen port")
configPath := flag.String("config_path", "../config/", "config folder")
flag.Parse()
config.InitConfig(*configPath)
var wg sync.WaitGroup
wg.Add(1)
log.NewPrivateLog(constant.LogFileName)

@ -18,7 +18,9 @@ import (
func start(rpcPorts []int, rpcRegisterName string, prometheusPorts []int, rpcFn func(client *openKeeper.ZkClient, server *grpc.Server) error, options []grpc.ServerOption) error {
flagRpcPort := flag.Int("port", rpcPorts[0], "get RpcGroupPort from cmd,default 16000 as port")
flagPrometheusPort := flag.Int("prometheus_port", prometheusPorts[0], "groupPrometheusPort default listen port")
configPath := flag.String("config_path", "../config/", "config folder")
flag.Parse()
config.InitConfig(*configPath)
fmt.Println("start group rpc server, port: ", *flagRpcPort, ", OpenIM version: ", constant.CurrentVersion)
log.NewPrivateLog(constant.LogFileName)
listener, err := net.Listen("tcp", fmt.Sprintf("%s:%d", config.Config.ListenIP, *flagRpcPort))

@ -1,7 +1,6 @@
package config
import (
"flag"
"fmt"
"io/ioutil"
"os"
@ -537,10 +536,8 @@ func initConfig(config interface{}, configName, configPath string) {
unmarshalConfig(config, configPath)
}
func InitConfig() {
configPath := flag.String("config_path", "../config/", "config folder")
flag.Parse()
initConfig(&Config, "config.yaml", *configPath)
initConfig(&NotificationConfig, "notification.yaml", *configPath)
func InitConfig(configPath string) {
initConfig(&Config, "config.yaml", configPath)
initConfig(&NotificationConfig, "notification.yaml", configPath)
Config.Notification = NotificationConfig.Notification
}

@ -1,21 +1,21 @@
#Don't put the space between "="
msg_gateway_name="open_im_msg_gateway"
msg_gateway_binary_root="../bin/"
msg_gateway_source_root="../cmd/open_im_msg_gateway/"
msg_gateway_source_root="../cmd/msggateway/"
msg_name="open_im_msg"
msg_binary_root="../bin/"
msg_source_root="../cmd/rpc/open_im_msg/"
msg_source_root="../cmd/rpc/msg/"
push_name="open_im_push"
push_binary_root="../bin/"
push_source_root="../cmd/open_im_push/"
push_source_root="../cmd/push/"
msg_transfer_name="open_im_msg_transfer"
msg_transfer_binary_root="../bin/"
msg_transfer_source_root="../cmd/open_im_msg_transfer/"
msg_transfer_source_root="../cmd/msgtransfer/"
msg_transfer_service_num=4
@ -26,23 +26,28 @@ sdk_server_source_root="../cmd/Open-IM-SDK-Core/"
cron_task_name="open_im_cron_task"
cron_task_binary_root="../bin/"
cron_task_source_root="../cmd/open_im_cron_task/"
cron_task_source_root="../cmd/crontask/"
cmd_utils_name="open_im_cmd_utils"
cmd_utils_binary_root="../bin/"
cmd_utils_source_root="../cmd/cmduitls/"
#Global configuration file default dir
config_path="../config/config.yaml"
#servicefile dir path
service_source_root=(
#api service file
../cmd/open_im_api/
../cmd/api/
#rpc service file
../cmd/rpc/open_im_user/
../cmd/rpc/open_im_friend/
../cmd/rpc/open_im_group/
../cmd/rpc/open_im_auth/
../cmd/rpc/open_im_conversation/
../cmd/open_im_cron_task
../cmd/rpc/user/
../cmd/rpc/friend/
../cmd/rpc/group/
../cmd/rpc/auth/
../cmd/rpc/conversation/
../cmd/crontask
../cmd/cmdutils
${msg_gateway_source_root}
${msg_transfer_source_root}
${msg_source_root}
@ -60,6 +65,7 @@ service_names=(
open_im_auth
open_im_conversation
open_im_cron_task
open_im_cmd_utils
${msg_gateway_name}
${msg_transfer_name}
${msg_name}

Loading…
Cancel
Save