Skip to content

Commit

Permalink
Revert "Extend configuration for edgex services to include uri/path."
Browse files Browse the repository at this point in the history
  • Loading branch information
TiejunChina authored and badboy-huaqiao committed Nov 27, 2019
1 parent 4f973d1 commit c4ab4ee
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
11 changes: 1 addition & 10 deletions app/common/proxyhandler.go
Expand Up @@ -34,7 +34,6 @@ const (
var DynamicProxyCache = make(map[string]string, 10)

func ProxyHandler(w http.ResponseWriter, r *http.Request, path string, prefix string, token string) {
var proxyPath string
defer r.Body.Close()

targetIP := DynamicProxyCache[token]
Expand All @@ -43,28 +42,20 @@ func ProxyHandler(w http.ResponseWriter, r *http.Request, path string, prefix st
switch prefix {
case configs.ProxyConf.CoreDataPath:
targetAddr += configs.ProxyConf.CoreDataPort
proxyPath = configs.ProxyConf.CoreDataUri + path
case configs.ProxyConf.CoreMetadataPath:
targetAddr += configs.ProxyConf.CoreMetadataPort
proxyPath = configs.ProxyConf.CoreMetadataUri + path
case configs.ProxyConf.CoreCommandPath:
targetAddr += configs.ProxyConf.CoreCommandPort
proxyPath = configs.ProxyConf.CoreCommandUri + path
case configs.ProxyConf.CoreExportPath:
targetAddr += configs.ProxyConf.CoreExportPort
proxyPath = configs.ProxyConf.CoreExportUri + path
case configs.ProxyConf.RuleEnginePath:
targetAddr += configs.ProxyConf.RuleEnginePort
proxyPath = configs.ProxyConf.RuleEngineUri + path
case configs.ProxyConf.SupportLoggingPath:
targetAddr += configs.ProxyConf.SupportLoggingPort
proxyPath = configs.ProxyConf.SupportLoggingUri + path
case configs.ProxyConf.SupportNotificationPath:
targetAddr += configs.ProxyConf.SupportNotificationPort
proxyPath = configs.ProxyConf.SupportNotificationUri + path
case configs.ProxyConf.SupportSchedulerPath:
targetAddr += configs.ProxyConf.SupportSchedulerPort
proxyPath = configs.ProxyConf.SupportSchedulerUri + path
}

origin, _ := url.Parse(targetAddr)
Expand All @@ -74,7 +65,7 @@ func ProxyHandler(w http.ResponseWriter, r *http.Request, path string, prefix st
req.Header.Add(OriginHostReqHeader, origin.Host)
req.URL.Scheme = HttpProtocol
req.URL.Host = origin.Host
req.URL.Path = proxyPath
req.URL.Path = path
}

proxy := &httputil.ReverseProxy{Director: director}
Expand Down
8 changes: 0 additions & 8 deletions app/configs/configuration.go
Expand Up @@ -67,35 +67,27 @@ type Database struct {
type DynamicProxy struct {
CoreDataPath string
CoreDataPort string
CoreDataUri string

CoreMetadataPath string
CoreMetadataPort string
CoreMetadataUri string

CoreCommandPath string
CoreCommandPort string
CoreCommandUri string

CoreExportPath string
CoreExportPort string
CoreExportUri string

RuleEnginePath string
RuleEnginePort string
RuleEngineUri string

SupportLoggingPath string
SupportLoggingPort string
SupportLoggingUri string

SupportNotificationPath string
SupportNotificationPort string
SupportNotificationUri string

SupportSchedulerPath string
SupportSchedulerPort string
SupportSchedulerUri string
}

func LoadConfig(confFilePath string) error {
Expand Down
8 changes: 0 additions & 8 deletions cmd/edgex-ui-server/res/configuration.toml
Expand Up @@ -19,25 +19,17 @@ Password = "su"
[DynamicProxy]
CoreDataPath = "/core-data"
CoreDataPort = "48080"
CoreDataUri = ""
CoreMetadataPath = "/core-metadata"
CoreMetadataPort = "48081"
CoreMetadataUri = ""
CoreCommandPath = "/core-command"
CoreCommandPort = "48082"
CoreCommandUri = ""
CoreExportPath = "/core-export"
CoreExportPort = "48071"
CoreExportUri = ""
RuleEnginePath = "/rule-engine"
RuleEnginePort = "48075"
RuleEngineUri = ""
SupportLoggingPath = "/support-logging"
SupportLoggingPort = "48061"
SupportLoggingUri = ""
SupportNotificationPath = "/support-notification"
SupportNotificationPort = "48060"
SupportNotificationUri = ""
SupportSchedulerPath = "/support-scheduler"
SupportSchedulerPort = "48085"
SupportSchedulerUri = ""

0 comments on commit c4ab4ee

Please sign in to comment.