Commit 1b6f4710 authored by Node- 门 忠鑫's avatar Node- 门 忠鑫

Merge branch 'master' into alter

parents c198d956 0108c3c7
......@@ -14,12 +14,16 @@ import (
)
func main() {
conf.Init()
var port string
var quartz bool
flag.StringVar(&port, "port", conf.GlobalConfig.Port, "端口")
var denv string
var didc string
flag.StringVar(&port, "port", "10086", "端口")
flag.BoolVar(&quartz, "quartz", false, "quartz")
flag.StringVar(&denv, "env", "dev", "环境")
flag.StringVar(&didc, "idc", "local", "机房")
flag.Parse()
conf.Load(denv, didc)
file, err := os.OpenFile("quantgroup.log", os.O_RDWR|os.O_CREATE, 0666)
defer func() { _ = file.Close() }()
......
......@@ -4,22 +4,16 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"net/http"
)
var GlobalConfig = Config{}
func Init() {
denv := os.Getenv("Denv")
if "" == denv {
denv = "dev"
}
var filename = "service/conf/" + denv + "/conf.json"
bytes, err := ioutil.ReadFile(filename)
if nil != err {
fmt.Println("启动报错:未找到对应的环境变量配置。env: " + filename)
}
func Load(denv string, didc string) {
url := "http://apollo-" + denv + ".quantgroups.com/configfiles/real_json/enoch/" + didc + "/tech.config.json"
resp, err := http.Get(url)
defer func() { _ = resp.Body.Close() }()
bytes, err := ioutil.ReadAll(resp.Body)
err = json.Unmarshal(bytes, &GlobalConfig)
GlobalConfig.Env = denv
if nil != err {
......
......@@ -66,7 +66,6 @@ func msgInfluxProcess(traceMsgs []TraceMsg) {
}
unix := time.Unix(0, traceMsg.Timestamp*1000)
if len(pointSlice) == batchSize {
go batchWrite(pointSlice)
pointSlice = make([]*client.Point, 0, batchSize)
......
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 to comment