cli: Do not show metrics in greeting, if disabled

Closes https://github.com/tus/tusd/issues/760
This commit is contained in:
Marius 2022-08-04 11:39:55 +02:00
parent 884591d1c9
commit 83015bfdf6
1 changed files with 8 additions and 3 deletions

View File

@ -8,6 +8,12 @@ import (
var greeting string
func PrepareGreeting() {
// Do not show information about metric endpoint, if it is not exposed
metricsInfo := ""
if Flags.ExposeMetrics {
metricsInfo = fmt.Sprintf("- %s - gather statistics to keep tusd running smoothly\n", Flags.MetricsPath)
}
greeting = fmt.Sprintf(
`Welcome to tusd
===============
@ -20,15 +26,14 @@ While you did an awesome job on getting tusd running, this is just the welcome
message, so let's talk about the places that really matter:
- %s - send your tus uploads to this endpoint
- %s - gather statistics to keep tusd running smoothly
- https://github.com/tus/tusd/issues - report your bugs here
%s- https://github.com/tus/tusd/issues - report your bugs here
So quit lollygagging, send over your files and experience the future!
Version = %s
GitCommit = %s
BuildDate = %s
`, Flags.Basepath, Flags.MetricsPath, VersionName, GitCommit, BuildDate)
`, Flags.Basepath, metricsInfo, VersionName, GitCommit, BuildDate)
}
func DisplayGreeting(w http.ResponseWriter, r *http.Request) {