mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-03-16 17:54:07 +01:00
Replace www-path with www-proxy option for development (#248)
By adding a new ENV variable called `WOODPECKER_WWW_PROXY` it is possible to serve a webinterface via a proxy configured by the `WOODPECKER_WWW_PROXY` value for development instead of serving the interface from the bundled code or from some folder location as the old `WOODPECKER_WWW` option allowed. Using a proxy allows developing the UI with hot-reloading.
This commit is contained in:
@@ -19,9 +19,7 @@ import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/model"
|
||||
@@ -45,10 +43,6 @@ func New(opt ...Option) Endpoint {
|
||||
f(opts)
|
||||
}
|
||||
|
||||
if opts.path != "" {
|
||||
return fromPath(opts)
|
||||
}
|
||||
|
||||
return &website{
|
||||
fs: dist.New(),
|
||||
opts: opts,
|
||||
@@ -58,19 +52,6 @@ func New(opt ...Option) Endpoint {
|
||||
}
|
||||
}
|
||||
|
||||
func fromPath(opts *Options) *website {
|
||||
f := filepath.Join(opts.path, "index.html")
|
||||
b, err := ioutil.ReadFile(f)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return &website{
|
||||
fs: http.Dir(opts.path),
|
||||
tmpl: mustCreateTemplate(string(b)),
|
||||
opts: opts,
|
||||
}
|
||||
}
|
||||
|
||||
type website struct {
|
||||
opts *Options
|
||||
fs http.FileSystem
|
||||
|
||||
Reference in New Issue
Block a user