Commit 7a6ecd69 by mushishixian

启动配置

parent ebe0a3af
set MICRO_REGISTRY=etcd
set MICRO_REGISTRY_ADDRESS=192.168.2.232:2379
go run ../cmd/course_http_server.go --server_address :9000
\ No newline at end of file
go run ../cmd/course_http_server.go
\ No newline at end of file
......@@ -8,12 +8,12 @@ import (
"search_server/boot"
_ "search_server/controller"
"search_server/framework/gin_"
"search_server/pkg/config"
)
func main() {
var path,temp string
var path string
flag.StringVar(&path, "config", "../conf/config.ini", "配置文件")
flag.StringVar(&temp, "server_address", "conf/config.ini", "配置文件")
flag.Parse()
if err := boot.Boot(path); err != nil {
log.Println(err)
......@@ -22,11 +22,14 @@ func main() {
r := gin.New()
gin_.BootStrap(r)
port := config.Get("web.port").String()
//web改成micro 就是grpc,并直接注册到etcd里面
service := web.NewService(
web.Name("go.micro.api.http.course"),
web.Handler(r),
web.Address(":"+port),
)
if err := service.Init(); err != nil {
log.Println(err)
}
......
[web]
port = 9000
[database]
user_name = root
password = root
......
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