Commit 3b26bc2c by mushishixian

优化

parent d10cc5f6
package configs
import (
"fmt"
"gopkg.in/ini.v1"
"os"
)
var Cfg *ini.File
func init() {
//func init() {
// var err error
// Cfg, err = ini.Load("conf/config.ini")
// if err != nil {
// fmt.Printf("Fail to read file: %v", err)
// os.Exit(1)
// }
//}
func Setup(path string){
var err error
Cfg, err = ini.Load("conf/config.ini")
Cfg, err = ini.Load(path)
if err != nil {
fmt.Printf("Fail to read file: %v", err)
os.Exit(1)
}
}
......
package main
import (
"flag"
"scm_server/cmd/queue/sync_audit_status"
"scm_server/cmd/queue/sync_customer"
"scm_server/cmd/queue/sync_goods"
......@@ -31,7 +32,7 @@ func pushAlive() {
item PayloadItem
url string
//resp *req.Resp
err error
err error
)
item = PayloadItem{
Endpoint: "fengkong-server/172.18.137.41",
......@@ -44,8 +45,6 @@ func pushAlive() {
}
payload = append(payload, item)
param := req.BodyJSON(&payload)
//temp,_:=json.Marshal(payload)
//fmt.Println(string(temp))
req.Debug = false
url = configs.OpenFalconPushUrl
_, err = req.Post(url, param)
......@@ -54,6 +53,16 @@ func pushAlive() {
}
}
var (
ConfFile string // 配置文件路径
)
func init() {
// master -config ./conf/config.ini
flag.StringVar(&ConfFile, "config", "./conf/config.ini", "./conf/config.ini")
flag.Parse()
}
func main() {
go sync_customer.Sync()
go sync_supplier.Sync()
......
......@@ -3,6 +3,8 @@ cd /data2/gocode/scm_server
git pull origin master
rm ./sh/scm_wms_sync
rm ./sh/import_source
rm ./conf/config.ini
mv ./conf/config_production.ini ./conf/config.ini
go build -o ./sh/scm_wms_sync ./main.go
go build -o ./sh/import_source ./cmd/source/main.go
supervisorctl restart scm:scm_server
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment