Fix the default external app urls
They were hardcoded to localhost:9200 instead of using the server url config.
This commit is contained in:
@@ -72,11 +72,11 @@ func (p Phoenix) getPayload() (payload []byte, err error) {
|
||||
p.config.Phoenix.Config.ExternalApps = []config.ExternalApp{
|
||||
{
|
||||
ID: "accounts",
|
||||
Path: "https://localhost:9200/accounts.js",
|
||||
Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "accounts.js"),
|
||||
},
|
||||
{
|
||||
ID: "settings",
|
||||
Path: "https://localhost:9200/settings.js",
|
||||
Path: singleJoiningSlash(p.config.Phoenix.Config.Server, "settings.js"),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -109,6 +109,18 @@ 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) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user