加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
hidu 提交于 2016-01-16 21:25 . new version 0.6.6 add services list
package main
import (
"flag"
"fmt"
"github.com/hidu/api-front/proxy"
"log"
"strings"
)
var confPath = flag.String("conf", "./conf/server.json", "server conf path")
var confDemo = flag.Bool("conf_demo", false, "show the demo conf")
func init() {
log.SetFlags(log.Lshortfile | log.LstdFlags | log.Ldate)
ua := flag.Usage
flag.Usage = func() {
ua()
fmt.Println("\n site: https://github.com/hidu/api-front")
fmt.Println(" version:", proxy.APIFrontVersion)
}
}
func main() {
flag.Parse()
if *confDemo {
showConfDemo()
return
}
manager := proxy.NewAPIServerManager(*confPath)
manager.Start()
}
func showConfDemo() {
conf := `
1. conf/server.json:
---------------------------------------------------------
{
"users":["admin"]
}
---------------------------------------------------------
2. conf/users:
---------------------------------------------------------
id:admin psw_md5:7bb483729b5a8e26f73e1831cde5b842 psw:psw
---------------------------------------------------------
3. conf/vhost/8080.json
---------------------------------------------------------
{
"port": 8080,
"group": "order",
"name": "order api",
"enable": true,
"hidden_cookie": true,
"note": "订单相关接口",
"users": [
"test"
]
}
---------------------------------------------------------
`
fmt.Println(strings.TrimSpace(conf))
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化