Add CLI flag to run-server.go for local plugins
Allows to map URL requests to local folder structure.
For example, to run against local gerrit-testsite:
/polygerrit-ui/run-server.sh \
--host=localhost:8080 \
--scheme=http \
--plugins=$HOME/gerrit-testsite/plugins/
Change-Id: I20510eb1c2cff93d253aa9f7f38bc42f59f557e9
diff --git a/polygerrit-ui/server.go b/polygerrit-ui/server.go
index 33f33b7..b19137e 100644
--- a/polygerrit-ui/server.go
+++ b/polygerrit-ui/server.go
@@ -33,6 +33,7 @@
port = flag.String("port", ":8081", "Port to serve HTTP requests on")
prod = flag.Bool("prod", false, "Serve production assets")
scheme = flag.String("scheme", "https", "URL scheme")
+ plugins = flag.String("plugins", "", "Path to local plugins folder")
)
func main() {
@@ -49,6 +50,11 @@
http.HandleFunc("/config/", handleRESTProxy)
http.HandleFunc("/projects/", handleRESTProxy)
http.HandleFunc("/accounts/self/detail", handleAccountDetail)
+ if len(*plugins) > 0 {
+ http.Handle("/plugins/", http.StripPrefix("/plugins/",
+ http.FileServer(http.Dir(*plugins))))
+ log.Println("Local plugins at", *plugins)
+ }
log.Println("Serving on port", *port)
log.Fatal(http.ListenAndServe(*port, &server{}))
}