Skip to content

Commit b38f772

Browse files
committed
web/landing_page: Add option to disable profiling links
Signed-off-by: Manuel Rüger <[email protected]>
1 parent fb7682a commit b38f772

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

web/landing_page.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type LandingConfig struct {
3838
ExtraHTML string // Additional HTML to be embedded.
3939
ExtraCSS string // Additional CSS to be embedded.
4040
Version string // The version displayed.
41+
Profiling string // If false, don't display profiling links.
4142
}
4243

4344
// LandingForm provides a configuration struct for creating a POST form on the landing page.
@@ -103,6 +104,10 @@ func NewLandingPage(c LandingConfig) (*LandingPageHandler, error) {
103104
} else if !strings.HasSuffix(c.RoutePrefix, "/") {
104105
c.RoutePrefix += "/"
105106
}
107+
108+
if c.Profiling == "" {
109+
c.Profiling = "true"
110+
}
106111
// Strip leading '/' from Links if present
107112
for i, link := range c.Links {
108113
c.Links[i].Address = strings.TrimPrefix(link.Address, "/")

web/landing_page.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ <h1>{{.Name}}</h1>
3030
</div>
3131
{{ end }}
3232
{{ .ExtraHTML }}
33+
{{ if eq .Profiling "true" }}
3334
<div id="pprof">
3435
Download a detailed report of resource usage (pprof format, from the Go runtime):
3536
<ul>
@@ -38,6 +39,7 @@ <h1>{{.Name}}</h1>
3839
</ul>
3940
To visualize and share profiles you can upload to <a href="https://pprof.me" target="_blank" rel="noopener noreferrer">pprof.me</a>
4041
</div>
42+
{{ end }}
4143
</main>
4244
</body>
4345
</html>

0 commit comments

Comments
 (0)