Commit 7a6ecd69 by mushishixian

启动配置

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