Convert pathPrefix to not have trailing slash.
This commit is contained in:
parent
d7b471f3cc
commit
d7c015c149
|
@ -17,7 +17,7 @@
|
|||
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="{{ pathPrefix }}alerts">Alerts</a></li>
|
||||
<li><a href="{{ pathPrefix }}/alerts">Alerts</a></li>
|
||||
<li><a href="https://www.pagerduty.com/">PagerDuty</a></li>
|
||||
</div>
|
||||
</ul>
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
{{/* vim: set ft=html: */}}
|
||||
{{/* Load Prometheus console library JS/CSS. Should go in <head> */}}
|
||||
{{ define "prom_console_head" }}
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}static/vendor/rickshaw/rickshaw.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}static/vendor/bootstrap-3.3.1/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}static/css/prom_console.css">
|
||||
<script src="{{ pathPrefix }}static/vendor/rickshaw/vendor/d3.v3.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/rickshaw/rickshaw.min.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/js/jquery.min.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/bootstrap-3.3.1/js/bootstrap.min.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/prom_console.css">
|
||||
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.v3.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/js/jquery.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/js/bootstrap.min.js"></script>
|
||||
|
||||
<script>var PATH_PREFIX = "{{ pathPrefix }}";</script>
|
||||
<script src="{{ pathPrefix }}static/js/prom_console.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/js/prom_console.js"></script>
|
||||
{{ end }}
|
||||
|
||||
{{/* Top of all pages. */}}
|
||||
|
|
8
main.go
8
main.go
|
@ -71,7 +71,7 @@ var (
|
|||
storageDirty = flag.Bool("storage.local.dirty", false, "If set, the local storage layer will perform crash recovery even if the last shutdown appears to be clean.")
|
||||
storagePedanticChecks = flag.Bool("storage.local.pedantic-checks", false, "If set, a crash recovery will perform checks on each series file. This might take a very long time.")
|
||||
|
||||
pathPrefix = flag.String("web.path-prefix", "/", "Prefix for all web paths.")
|
||||
pathPrefix = flag.String("web.path-prefix", "", "Prefix for all web paths.")
|
||||
|
||||
printVersion = flag.Bool("version", false, "Print version information.")
|
||||
)
|
||||
|
@ -377,12 +377,10 @@ func main() {
|
|||
os.Exit(2)
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(*pathPrefix, "/") {
|
||||
*pathPrefix = strings.TrimRight(*pathPrefix, "/")
|
||||
if *pathPrefix != "" && !strings.HasPrefix(*pathPrefix, "/") {
|
||||
*pathPrefix = "/" + *pathPrefix
|
||||
}
|
||||
if !strings.HasSuffix(*pathPrefix, "/") {
|
||||
*pathPrefix = *pathPrefix + "/"
|
||||
}
|
||||
|
||||
versionInfoTmpl.Execute(os.Stdout, BuildInfo)
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import (
|
|||
"fmt"
|
||||
"html/template"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
@ -221,9 +220,9 @@ func (rule *AlertingRule) HTMLSnippet(pathPrefix string) template.HTML {
|
|||
}
|
||||
return template.HTML(fmt.Sprintf(
|
||||
`ALERT <a href="%s">%s</a> IF <a href="%s">%s</a> FOR %s WITH %s`,
|
||||
pathPrefix+strings.TrimLeft(utility.GraphLinkForExpression(alertMetric.String()), "/"),
|
||||
pathPrefix+utility.GraphLinkForExpression(alertMetric.String()),
|
||||
rule.name,
|
||||
pathPrefix+strings.TrimLeft(utility.GraphLinkForExpression(rule.Vector.String()), "/"),
|
||||
pathPrefix+utility.GraphLinkForExpression(rule.Vector.String()),
|
||||
rule.Vector,
|
||||
utility.DurationToString(rule.holdDuration),
|
||||
rule.Labels))
|
||||
|
|
|
@ -17,7 +17,6 @@ import (
|
|||
"fmt"
|
||||
"html/template"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
clientmodel "github.com/prometheus/client_golang/model"
|
||||
|
||||
|
@ -90,9 +89,9 @@ func (rule RecordingRule) HTMLSnippet(pathPrefix string) template.HTML {
|
|||
ruleExpr := rule.vector.String()
|
||||
return template.HTML(fmt.Sprintf(
|
||||
`<a href="%s">%s</a>%s = <a href="%s">%s</a>`,
|
||||
pathPrefix+strings.TrimLeft(utility.GraphLinkForExpression(rule.name), "/"),
|
||||
pathPrefix+utility.GraphLinkForExpression(rule.name),
|
||||
rule.name,
|
||||
rule.labels,
|
||||
pathPrefix+strings.TrimLeft(utility.GraphLinkForExpression(ruleExpr), "/"),
|
||||
pathPrefix+utility.GraphLinkForExpression(ruleExpr),
|
||||
ruleExpr))
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ func TestTemplateExpansion(t *testing.T) {
|
|||
for i, s := range scenarios {
|
||||
var result string
|
||||
var err error
|
||||
expander := NewTemplateExpander(s.text, "test", s.input, time, engine, "/")
|
||||
expander := NewTemplateExpander(s.text, "test", s.input, time, engine, "")
|
||||
if s.html {
|
||||
result, err = expander.ExpandHTML(nil)
|
||||
} else {
|
||||
|
|
|
@ -39,13 +39,13 @@ func (msrv *MetricsService) RegisterHandler(pathPrefix string) {
|
|||
Handler: http.HandlerFunc(h),
|
||||
}
|
||||
}
|
||||
http.Handle(pathPrefix+"api/query", prometheus.InstrumentHandler(
|
||||
pathPrefix+"api/query", handler(msrv.Query),
|
||||
http.Handle(pathPrefix+"/api/query", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/api/query", handler(msrv.Query),
|
||||
))
|
||||
http.Handle(pathPrefix+"api/query_range", prometheus.InstrumentHandler(
|
||||
pathPrefix+"api/query_range", handler(msrv.QueryRange),
|
||||
http.Handle(pathPrefix+"/api/query_range", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/api/query_range", handler(msrv.QueryRange),
|
||||
))
|
||||
http.Handle(pathPrefix+"api/metrics", prometheus.InstrumentHandler(
|
||||
pathPrefix+"api/metrics", handler(msrv.Metrics),
|
||||
http.Handle(pathPrefix+"/api/metrics", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/api/metrics", handler(msrv.Metrics),
|
||||
))
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ func TestQuery(t *testing.T) {
|
|||
Storage: storage,
|
||||
QueryEngine: promql.NewEngine(storage),
|
||||
}
|
||||
api.RegisterHandler("/")
|
||||
api.RegisterHandler("")
|
||||
|
||||
server := httptest.NewServer(http.DefaultServeMux)
|
||||
defer server.Close()
|
||||
|
|
|
@ -160,7 +160,7 @@ Prometheus.Graph.prototype.populateInsertableMetrics = function() {
|
|||
var self = this;
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: PATH_PREFIX + "api/metrics",
|
||||
url: PATH_PREFIX + "/api/metrics",
|
||||
dataType: "json",
|
||||
success: function(json, textStatus) {
|
||||
var availableMetrics = [];
|
||||
|
@ -312,7 +312,7 @@ Prometheus.Graph.prototype.submitQuery = function() {
|
|||
url = self.queryForm.attr("action");
|
||||
success = function(json, textStatus) { self.handleGraphResponse(json, textStatus); };
|
||||
} else {
|
||||
url = PATH_PREFIX + "api/query";
|
||||
url = PATH_PREFIX + "/api/query";
|
||||
success = function(text, textStatus) { self.handleConsoleResponse(text, textStatus); };
|
||||
}
|
||||
|
||||
|
@ -611,7 +611,7 @@ function init() {
|
|||
});
|
||||
|
||||
$.ajax({
|
||||
url: PATH_PREFIX + "static/js/graph_template.handlebar",
|
||||
url: PATH_PREFIX + "/static/js/graph_template.handlebar",
|
||||
success: function(data) {
|
||||
graphTemplate = Handlebars.compile(data);
|
||||
var options = parseGraphOptionsFromURL();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div id="graph_wrapper{{id}}" class="graph_wrapper">
|
||||
<form action="{{ pathPrefix }}api/query_range" method="GET" class="query_form form-inline">
|
||||
<form action="{{ pathPrefix }}/api/query_range" method="GET" class="query_form form-inline">
|
||||
<div class="row">
|
||||
<div class="col-lg-10">
|
||||
<span class="input-group expression_input_group">
|
||||
|
@ -14,7 +14,7 @@
|
|||
</div>
|
||||
<div class="col-lg-2">
|
||||
<div class="eval_stats pull-right"></div>
|
||||
<img src="{{ pathPrefix }}static/img/ajax-loader.gif" class="spinner" alt="ajax_spinner">
|
||||
<img src="{{ pathPrefix }}/static/img/ajax-loader.gif" class="spinner" alt="ajax_spinner">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
|
@ -502,7 +502,7 @@ PromConsole.Graph.prototype.dispatch = function() {
|
|||
var pending_requests = this.params.expr.length;
|
||||
for (var i = 0; i < this.params.expr.length; ++i) {
|
||||
var endTime = this.params.endTime;
|
||||
var url = PATH_PREFIX + "api/query_range?expr=" + encodeURIComponent(this.params.expr[i])
|
||||
var url = PATH_PREFIX + "/api/query_range?expr=" + encodeURIComponent(this.params.expr[i])
|
||||
+ "&step=" + this.params.duration / this.graphTd.offsetWidth
|
||||
+ "&range=" + this.params.duration + "&end=" + endTime;
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
@ -539,7 +539,7 @@ PromConsole.Graph.prototype.dispatch = function() {
|
|||
}
|
||||
|
||||
var loadingImg = document.createElement("img");
|
||||
loadingImg.src = PATH_PREFIX + 'static/img/ajax-loader.gif';
|
||||
loadingImg.src = PATH_PREFIX + '/static/img/ajax-loader.gif';
|
||||
loadingImg.alt = 'Loading...';
|
||||
loadingImg.className = 'prom_graph_loading';
|
||||
this.graphTd.appendChild(loadingImg);
|
||||
|
@ -605,6 +605,6 @@ PromConsole._graphsToSlashGraphURL = function(exprs) {
|
|||
for (var i = 0; i < exprs.length; ++i) {
|
||||
data.push({'expr': exprs[i], 'tab': 0});
|
||||
}
|
||||
return PATH_PREFIX + 'graph#' + encodeURIComponent(JSON.stringify(data));
|
||||
return PATH_PREFIX + '/graph#' + encodeURIComponent(JSON.stringify(data));
|
||||
|
||||
};
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Prometheus Time Series Collection and Processing Server</title>
|
||||
<script src="{{ pathPrefix }}static/vendor/js/jquery.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/js/jquery.min.js"></script>
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}static/vendor/bootstrap-3.3.1/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}static/css/prometheus.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/css/bootstrap.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/prometheus.css">
|
||||
|
||||
<script>var PATH_PREFIX = "{{ pathPrefix }}";</script>
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
|||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="{{ pathPrefix }}">Prometheus</a>
|
||||
<a class="navbar-brand" href="{{ pathPrefix }}/">Prometheus</a>
|
||||
</div>
|
||||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-left">
|
||||
|
@ -31,9 +31,9 @@
|
|||
{{if $consoles}}
|
||||
<li><a href="{{$consoles}}">Consoles</a></li>
|
||||
{{ end }}
|
||||
<li><a href="{{ pathPrefix }}alerts">Alerts</a></li>
|
||||
<li><a href="{{ pathPrefix }}graph">Graph</a></li>
|
||||
<li><a href="{{ pathPrefix }}">Status</a></li>
|
||||
<li><a href="{{ pathPrefix }}/alerts">Alerts</a></li>
|
||||
<li><a href="{{ pathPrefix }}/graph">Graph</a></li>
|
||||
<li><a href="{{ pathPrefix }}/">Status</a></li>
|
||||
<li>
|
||||
<a href="http://prometheus.io" target="_blank">Help</a>
|
||||
</li>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{define "head"}}
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}static/css/alerts.css">
|
||||
<script src="{{ pathPrefix }}static/js/alerts.js"></script>
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/alerts.css">
|
||||
<script src="{{ pathPrefix }}/static/js/alerts.js"></script>
|
||||
{{end}}
|
||||
|
||||
{{define "content"}}
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
{{define "head"}}
|
||||
<script src="{{ pathPrefix }}static/vendor/bootstrap-3.3.1/js/bootstrap.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/bootstrap-3.3.1/js/bootstrap.min.js"></script>
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}static/css/graph.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/css/graph.css">
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}static/vendor/rickshaw/rickshaw.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}static/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.css">
|
||||
<link type="text/css" rel="stylesheet" href="{{ pathPrefix }}/static/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css">
|
||||
|
||||
<script src="{{ pathPrefix }}static/vendor/rickshaw/vendor/d3.v3.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/rickshaw/rickshaw.min.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/bootstrap3-typeahead/bootstrap3-typeahead.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.v3.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/rickshaw/vendor/d3.layout.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/rickshaw/rickshaw.min.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/bootstrap3-typeahead/bootstrap3-typeahead.min.js"></script>
|
||||
|
||||
<script src="{{ pathPrefix }}static/vendor/js/handlebars.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/js/jquery.selection.js"></script>
|
||||
<script src="{{ pathPrefix }}static/vendor/js/jquery.hotkeys.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/js/handlebars.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/js/jquery.selection.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/vendor/js/jquery.hotkeys.js"></script>
|
||||
|
||||
<script src="{{ pathPrefix }}static/js/graph.js"></script>
|
||||
<script src="{{ pathPrefix }}/static/js/graph.js"></script>
|
||||
|
||||
<script id="graph_template" type="text/x-handlebars-template"></script>
|
||||
{{end}}
|
||||
|
|
48
web/web.go
48
web/web.go
|
@ -68,51 +68,51 @@ func (ws WebService) ServeForever(pathPrefix string) {
|
|||
http.HandleFunc("/", prometheus.InstrumentHandlerFunc(pathPrefix, func(rw http.ResponseWriter, req *http.Request) {
|
||||
// The "/" pattern matches everything, so we need to check
|
||||
// that we're at the root here.
|
||||
if req.URL.Path == pathPrefix {
|
||||
if req.URL.Path == pathPrefix+"/" {
|
||||
ws.StatusHandler.ServeHTTP(rw, req)
|
||||
} else if req.URL.Path == strings.TrimRight(pathPrefix, "/") {
|
||||
http.Redirect(rw, req, pathPrefix, http.StatusFound)
|
||||
} else if !strings.HasPrefix(req.URL.Path, pathPrefix) {
|
||||
} else if req.URL.Path == pathPrefix {
|
||||
http.Redirect(rw, req, pathPrefix+"/", http.StatusFound)
|
||||
} else if !strings.HasPrefix(req.URL.Path, pathPrefix+"/") {
|
||||
// We're running under a prefix but the user requested something
|
||||
// outside of it. Let's see if this page exists under the prefix.
|
||||
http.Redirect(rw, req, pathPrefix+strings.TrimLeft(req.URL.Path, "/"), http.StatusFound)
|
||||
http.Redirect(rw, req, pathPrefix+req.URL.Path, http.StatusFound)
|
||||
} else {
|
||||
http.NotFound(rw, req)
|
||||
}
|
||||
}))
|
||||
http.Handle(pathPrefix+"alerts", prometheus.InstrumentHandler(
|
||||
pathPrefix+"alerts", ws.AlertsHandler,
|
||||
http.Handle(pathPrefix+"/alerts", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/alerts", ws.AlertsHandler,
|
||||
))
|
||||
http.Handle(pathPrefix+"consoles/", prometheus.InstrumentHandler(
|
||||
pathPrefix+"consoles/", http.StripPrefix(pathPrefix+"consoles/", ws.ConsolesHandler),
|
||||
http.Handle(pathPrefix+"/consoles/", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/consoles/", http.StripPrefix(pathPrefix+"/consoles/", ws.ConsolesHandler),
|
||||
))
|
||||
http.Handle(pathPrefix+"graph", prometheus.InstrumentHandler(
|
||||
pathPrefix+"graph", ws.GraphsHandler,
|
||||
http.Handle(pathPrefix+"/graph", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/graph", ws.GraphsHandler,
|
||||
))
|
||||
http.Handle(pathPrefix+"heap", prometheus.InstrumentHandler(
|
||||
pathPrefix+"heap", http.HandlerFunc(dumpHeap),
|
||||
http.Handle(pathPrefix+"/heap", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/heap", http.HandlerFunc(dumpHeap),
|
||||
))
|
||||
|
||||
ws.MetricsHandler.RegisterHandler(pathPrefix)
|
||||
http.Handle(pathPrefix+strings.TrimLeft(*metricsPath, "/"), prometheus.Handler())
|
||||
http.Handle(pathPrefix+*metricsPath, prometheus.Handler())
|
||||
if *useLocalAssets {
|
||||
http.Handle(pathPrefix+"static/", prometheus.InstrumentHandler(
|
||||
pathPrefix+"static/", http.StripPrefix(pathPrefix+"static/", http.FileServer(http.Dir("web/static"))),
|
||||
http.Handle(pathPrefix+"/static/", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/static/", http.StripPrefix(pathPrefix+"/static/", http.FileServer(http.Dir("web/static"))),
|
||||
))
|
||||
} else {
|
||||
http.Handle(pathPrefix+"static/", prometheus.InstrumentHandler(
|
||||
pathPrefix+"static/", http.StripPrefix(pathPrefix+"static/", new(blob.Handler)),
|
||||
http.Handle(pathPrefix+"/static/", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/static/", http.StripPrefix(pathPrefix+"/static/", new(blob.Handler)),
|
||||
))
|
||||
}
|
||||
|
||||
if *userAssetsPath != "" {
|
||||
http.Handle(pathPrefix+"user/", prometheus.InstrumentHandler(
|
||||
pathPrefix+"user/", http.StripPrefix(pathPrefix+"user/", http.FileServer(http.Dir(*userAssetsPath))),
|
||||
http.Handle(pathPrefix+"/user/", prometheus.InstrumentHandler(
|
||||
pathPrefix+"/user/", http.StripPrefix(pathPrefix+"/user/", http.FileServer(http.Dir(*userAssetsPath))),
|
||||
))
|
||||
}
|
||||
|
||||
if *enableQuit {
|
||||
http.Handle(pathPrefix+"-/quit", http.HandlerFunc(ws.quitHandler))
|
||||
http.Handle(pathPrefix+"/-/quit", http.HandlerFunc(ws.quitHandler))
|
||||
}
|
||||
|
||||
log.Infof("Listening on %s", *listenAddress)
|
||||
|
@ -158,11 +158,11 @@ func getTemplateFile(name string) (string, error) {
|
|||
|
||||
func getConsoles(pathPrefix string) string {
|
||||
if _, err := os.Stat(*consoleTemplatesPath + "/index.html"); !os.IsNotExist(err) {
|
||||
return pathPrefix + "consoles/index.html"
|
||||
return pathPrefix + "/consoles/index.html"
|
||||
}
|
||||
if *userAssetsPath != "" {
|
||||
if _, err := os.Stat(*userAssetsPath + "/index.html"); !os.IsNotExist(err) {
|
||||
return pathPrefix + "user/index.html"
|
||||
return pathPrefix + "/user/index.html"
|
||||
}
|
||||
}
|
||||
return ""
|
||||
|
@ -251,7 +251,7 @@ func MustBuildServerURL(pathPrefix string) string {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return fmt.Sprintf("http://%s:%s%s", hostname, port, pathPrefix)
|
||||
return fmt.Sprintf("http://%s:%s/%s", hostname, port, pathPrefix)
|
||||
}
|
||||
|
||||
func getHostname() (string, error) {
|
||||
|
|
Loading…
Reference in New Issue