| | |
| | | SqlUsername string `json:"sql_username"` // 数据库用户 |
| | | SqlPassword string `json:"sql_password"` // 数据库密码 |
| | | NsqServer string `json:"nsq_server"` // nsq TCP服务端地址 |
| | | NsqWebApi string `json:"nsq_server"` // nsq HTTP接口地址 |
| | | NsqWebApi string `json:"nsq_webapi"` // nsq HTTP接口地址 |
| | | OrderTopic string `json:"order_topic"` // 订单上报的topic |
| | | InventoryTopic string `json:"inventory_topic"` // 库存上报的topic |
| | | QueryTopic string `json:"query_topic"` // 金蝶查询接口的topic |
| | | SyncInterval int `json:"interval"` // 同步的时间间隔, 单位/秒 |
| | | Debug bool `json:"debug"` // 本地调试, 取本地数据 |
| | | } |
| | | |
| | | const configPath = "config.json" |
| | |
| | | Options.SqlPassword = "123456" |
| | | Options.NsqServer = "fai365.com:4150" |
| | | Options.NsqWebApi = "http://121.31.232.83:9080/api/nsq/pub?topic=your_topic" |
| | | Options.OrderTopic = "/province/city/factoryNo/kingdee_seOrder" |
| | | Options.InventoryTopic = "/province/city/factoryNo/kingdee_inventory" |
| | | Options.OrderTopic = "aps.factory.erp.seorder" |
| | | Options.InventoryTopic = "aps.factory.erp.inventory" |
| | | Options.QueryTopic = "aps.factory.erp.k3resource" |
| | | Options.SyncInterval = 60 |
| | | Options.Debug = false |
| | | } |
| | | |
| | | func Load() { |
| | |
| | | fd := json.NewDecoder(file) |
| | | |
| | | fd.Decode(&Options) |
| | | |
| | | fmt.Printf("%v\n", Options) |
| | | } |
| | | } |
| | | |