You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.0 KiB

package main
import (
"flag"
"fmt"
"io/ioutil"
common "main_program/common"
"main_program/config"
move_data "main_program/moveData"
"gopkg.in/yaml.v2"
)
func init() {
flag.StringVar(&common.ConfigFile, "cf", "config.yml", "配置文件名")
}
func main() {
flag.Parse()
//读取配置文件
data, _ := ioutil.ReadFile(common.ConfigFile)
err := yaml.Unmarshal(data, &common.MyEnv)
if err != nil {
fmt.Println("读取配置文件错误...")
return
}
config.InitConfig(common.MyEnv.Log.LogEnv, common.MyEnv.Log.LogPath)
config.Logger.Info("初始化Logger成功...")
// 判断command
command := common.MyEnv.Command
config.Logger.Infof("Command:%s", common.MyEnv.Command)
if command == "move_data" {
// 判断参数
table := common.MyEnv.MoveData.Table
dbPath := common.MyEnv.MoveData.DBPath
if table == "" || dbPath == "" {
config.Logger.Error("move_data配置文件错误...")
return
}
config.Logger.Infof("开始调用move_data方法")
move_data.MoveDataService.Start(table, dbPath, common.MyEnv.Mysql)
}
}