kubectl proxy: make static prefix configurable

This commit is contained in:
Jimmi Dyson
2015-02-04 09:31:39 +00:00
parent 9384f01d56
commit e2baf049c0
3 changed files with 12 additions and 5 deletions

View File

@@ -33,7 +33,7 @@ type ProxyServer struct {
// NewProxyServer creates and installs a new ProxyServer.
// It automatically registers the created ProxyServer to http.DefaultServeMux.
func NewProxyServer(filebase string, cfg *client.Config) (*ProxyServer, error) {
func NewProxyServer(filebase string, staticPrefix string, cfg *client.Config) (*ProxyServer, error) {
prefix := cfg.Prefix
if prefix == "" {
prefix = "/api"
@@ -47,7 +47,7 @@ func NewProxyServer(filebase string, cfg *client.Config) (*ProxyServer, error) {
return nil, err
}
http.Handle("/api/", http.StripPrefix("/api/", proxy))
http.Handle("/static/", newFileHandler("/static/", filebase))
http.Handle(staticPrefix, newFileHandler(staticPrefix, filebase))
return proxy, nil
}