AppManager: Add API endpoint to install dodo app
Refactors cue definitions.
Next steps:
* Needs some cleanup, namespace is hard coded ...
* Maybe merge with regular install API
* Support exposing ports across clusters
Change-Id: Ibfc3c3f742b61f2c5874012fe6c77b958eae81d9
diff --git a/apps/canvas/server/main.go b/apps/canvas/server/main.go
index 7608049..82db481 100644
--- a/apps/canvas/server/main.go
+++ b/apps/canvas/server/main.go
@@ -108,11 +108,19 @@
json.NewEncoder(w).Encode(resp)
}
+func getPort() string {
+ if p, ok := os.LookupEnv("DODO_PORT_WEB"); ok {
+ return p
+ }
+ panic("port missing")
+}
+
func main() {
+ port := getPort()
http.HandleFunc("GET /saved", handleSavedGet)
http.HandleFunc("POST /saved", handleSave)
http.HandleFunc("GET /env", handleEnv)
http.HandleFunc("POST /deploy", handleDeploy)
- http.Handle("/", http.FileServer(http.Dir("/home/gio/code/dist")))
- log.Fatal(http.ListenAndServe(":3000", nil))
+ http.Handle("/", http.FileServer(http.Dir("./front")))
+ log.Fatal(http.ListenAndServe(fmt.Sprintf(":%s", port), nil))
}