Commit 83cc12bd authored by Node- 门 忠鑫's avatar Node- 门 忠鑫

# 修改环境变量获取方式

parent 6819e01a
......@@ -14,12 +14,14 @@ import (
)
func main() {
conf.Init()
var port string
var quartz bool
flag.StringVar(&port, "port", conf.GlobalConfig.Port, "端口")
var denv string
flag.StringVar(&port, "port", "10086", "端口")
flag.BoolVar(&quartz, "quartz", false, "quartz")
flag.StringVar(&denv, "env", "dev", "环境")
flag.Parse()
conf.Load(denv)
file, err := os.OpenFile("quantgroup.log", os.O_RDWR|os.O_CREATE, 0666)
defer func() { _ = file.Close() }()
......
......@@ -4,17 +4,11 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
)
var GlobalConfig = Config{}
func Init() {
denv := os.Getenv("Denv")
if "" == denv {
denv = "dev"
}
func Load(denv string) {
var filename = "service/conf/" + denv + "/conf.json"
bytes, err := ioutil.ReadFile(filename)
if nil != err {
......
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