Commit 3b26bc2c by mushishixian

优化

parent d10cc5f6
package configs package configs
import ( import (
"fmt"
"gopkg.in/ini.v1" "gopkg.in/ini.v1"
"os" "os"
) )
var Cfg *ini.File 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 var err error
Cfg, err = ini.Load("conf/config.ini") Cfg, err = ini.Load(path)
if err != nil { if err != nil {
fmt.Printf("Fail to read file: %v", err)
os.Exit(1) os.Exit(1)
} }
} }
......
package main package main
import ( import (
"flag"
"scm_server/cmd/queue/sync_audit_status" "scm_server/cmd/queue/sync_audit_status"
"scm_server/cmd/queue/sync_customer" "scm_server/cmd/queue/sync_customer"
"scm_server/cmd/queue/sync_goods" "scm_server/cmd/queue/sync_goods"
...@@ -44,8 +45,6 @@ func pushAlive() { ...@@ -44,8 +45,6 @@ func pushAlive() {
} }
payload = append(payload, item) payload = append(payload, item)
param := req.BodyJSON(&payload) param := req.BodyJSON(&payload)
//temp,_:=json.Marshal(payload)
//fmt.Println(string(temp))
req.Debug = false req.Debug = false
url = configs.OpenFalconPushUrl url = configs.OpenFalconPushUrl
_, err = req.Post(url, param) _, err = req.Post(url, param)
...@@ -54,6 +53,16 @@ func pushAlive() { ...@@ -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() { func main() {
go sync_customer.Sync() go sync_customer.Sync()
go sync_supplier.Sync() go sync_supplier.Sync()
......
...@@ -3,6 +3,8 @@ cd /data2/gocode/scm_server ...@@ -3,6 +3,8 @@ cd /data2/gocode/scm_server
git pull origin master git pull origin master
rm ./sh/scm_wms_sync rm ./sh/scm_wms_sync
rm ./sh/import_source 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/scm_wms_sync ./main.go
go build -o ./sh/import_source ./cmd/source/main.go go build -o ./sh/import_source ./cmd/source/main.go
supervisorctl restart scm:scm_server 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