Commit 0689224b authored by gaoshiyao's avatar gaoshiyao

更新路由设置

parent 58d1ca72
...@@ -3,4 +3,4 @@ MAINTAINER {{ AUTHOR }} ...@@ -3,4 +3,4 @@ MAINTAINER {{ AUTHOR }}
LABEL Author={{ AUTHOR }} Name={{ PROJECT }} Version={{ VERSION }} LABEL Author={{ AUTHOR }} Name={{ PROJECT }} Version={{ VERSION }}
COPY ./dist/. /app COPY ./dist/. /app
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["/app/proxy", "--port=80"] ENTRYPOINT ["/app/proxy", "--port=80","--prefix=/bgmesh/fiddler"]
...@@ -3,6 +3,7 @@ package config ...@@ -3,6 +3,7 @@ package config
var ( var (
RedisURL string RedisURL string
RedisTag string RedisTag string
Prefix string
) )
var ProxyConf = struct { var ProxyConf = struct {
......
...@@ -18,10 +18,11 @@ import ( ...@@ -18,10 +18,11 @@ import (
) )
var ( var (
argPort = pflag.Int("port", 8088, "") argPort = pflag.Int("port", 8088, "")
redisUrl = pflag.String("redisUrl", "redis://k8s.wodcloud.com:16379", "") argPrefix = pflag.String("prefix", "/bgmesh/fiddler", "")
redisTag = pflag.String("redisTag", "apaas-mesh-proxy", "") redisUrl = pflag.String("redisUrl", "redis://k8s.wodcloud.com:16379", "")
confPath = pflag.String("confPath", "/app/config/proxy.yaml", "") redisTag = pflag.String("redisTag", "apaas-mesh-proxy", "")
confPath = pflag.String("confPath", "/app/config/proxy.yaml", "")
) )
func main() { func main() {
...@@ -33,8 +34,9 @@ func main() { ...@@ -33,8 +34,9 @@ func main() {
} }
func server() error { func server() error {
config.Prefix = *argPrefix
handler := router.Load(ginrus.Ginrus(logrus.StandardLogger(), time.RFC3339, true)) handler := router.Load(ginrus.Ginrus(logrus.StandardLogger(), time.RFC3339, true))
fmt.Println(fmt.Sprintf("Listen Server on :%d", *argPort)) fmt.Println(fmt.Sprintf(":%d", *argPort))
return http.ListenAndServe( return http.ListenAndServe(
fmt.Sprintf(":%d", *argPort), fmt.Sprintf(":%d", *argPort),
handler, handler,
...@@ -52,6 +54,7 @@ func initEnv() { ...@@ -52,6 +54,7 @@ func initEnv() {
func initConfig() { func initConfig() {
config.RedisTag = *redisTag config.RedisTag = *redisTag
config.RedisURL = *redisUrl config.RedisURL = *redisUrl
config.Prefix = *argPrefix
} }
// 获取代理参数 // 获取代理参数
......
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