Change external app config to just use the paths of the js bundles

This commit is contained in:
Benedikt Kulmann
2020-09-10 10:27:47 +02:00
parent 1c8dc0741f
commit c4771b0910
+2 -14
View File
@@ -72,11 +72,11 @@ func (p Phoenix) getPayload() (payload []byte, err error) {
p.config.Phoenix.Config.ExternalApps = []config.ExternalApp{
{
ID: "accounts",
Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "accounts.js"),
Path: "/accounts.js",
},
{
ID: "settings",
Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "settings.js"),
Path: "/settings.js",
},
}
}
@@ -109,18 +109,6 @@ func (p Phoenix) getPayload() (payload []byte, err error) {
return
}
func singleJoiningSlash(a, b string) string {
aslash := strings.HasSuffix(a, "/")
bslash := strings.HasPrefix(b, "/")
switch {
case aslash && bslash:
return a + b[1:]
case !aslash && !bslash:
return a + "/" + b
}
return a + b
}
// Config implements the Service interface.
func (p Phoenix) Config(w http.ResponseWriter, r *http.Request) {