refactor(controller): added env and other fixes to account for running as a service
This commit is contained in:
@@ -88,16 +88,18 @@ func copyLatestBuild(server *socketio.Server, target string) {
|
||||
|
||||
func triggerRemoteUpdate(server *socketio.Server, remoteURL string, payload UpdatePayload) {
|
||||
|
||||
// basePath := "/api/controller"
|
||||
// if os.Getenv("NODE_ENV") != "production" {
|
||||
// basePath = "/lst/api/controller"
|
||||
// }
|
||||
fmt.Println("running the update process")
|
||||
basePath := "/api/controller"
|
||||
if os.Getenv("NODE_ENV") != "production" {
|
||||
basePath = "/lst/api/controller"
|
||||
}
|
||||
|
||||
// send POST request with JSON, expect SSE / streaming text back
|
||||
body, _ := json.Marshal(payload)
|
||||
|
||||
//url := fmt.Sprintf("https://%v.alpla.net%v/update", remoteURL, basePath)
|
||||
url := fmt.Sprintf("http://%v:8080/api/controller/update", remoteURL)
|
||||
url := fmt.Sprintf("https://%v.alpla.net%v/update", remoteURL, basePath)
|
||||
fmt.Println(url)
|
||||
//url := fmt.Sprintf("http://%v:8080/api/controller/update", remoteURL)
|
||||
fmt.Println(url)
|
||||
resp, err := http.Post(url, "application/json", bytes.NewBuffer(body))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user