Commit 2900fd96 authored by gaoshiyao's avatar gaoshiyao

应用代理

parent beceb130
......@@ -3,6 +3,7 @@ package config
var (
RedisURL string
RedisTag string
MeshId string
Prefix string
Url string
RedisUrl string
......
......@@ -18,6 +18,7 @@ import (
var (
argPort = pflag.Int("port", 8011, "")
argPrefix = pflag.String("prefix", "/bgmesh/fiddler", "")
meshId = pflag.String("meshId", "", "")
redisUrl = pflag.String("redisUrl", "redis://apaas-redis.apaas-v3:6379", "")
redisTag = pflag.String("redisTag", "apaas-mesh-proxy", "")
confPath = pflag.String("confPath", "/app/config/proxy.json", "")
......@@ -53,6 +54,7 @@ func initEnv() {
func initConfig() {
config.RedisTag = *redisTag
config.RedisURL = *redisUrl
config.MeshId = *meshId
config.Prefix = *argPrefix
config.DriverName = *dbDriverName
config.DbURL = *dbURL
......
......@@ -15,6 +15,7 @@
package router
import (
"fmt"
"github.com/gin-gonic/gin"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/config"
"gitlab.wodcloud.com/apaas/apaas-meshproxy/src/handler"
......@@ -29,10 +30,10 @@ func Load(middleware ...gin.HandlerFunc) http.Handler {
e.Use(header.Options)
e.Use(header.Secure)
e.Use(middleware...)
root := e.Group(config.Prefix)
root := e.Group(fmt.Sprintf("%s/%s", config.Prefix, config.MeshId))
{
root.Any("/:svcId/:applyId", handler.Proxy)
root.GET("/:svcId/:applyId/health", handler.Proxy)
root.Any("/:applyId", handler.Proxy)
root.GET("/:applyId/health", handler.Proxy)
}
return e
}
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