From 83015bfdf6a7d734647727ab9b1a185717040ded Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 4 Aug 2022 11:39:55 +0200 Subject: [PATCH] cli: Do not show metrics in greeting, if disabled Closes https://github.com/tus/tusd/issues/760 --- cmd/tusd/cli/greeting.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/tusd/cli/greeting.go b/cmd/tusd/cli/greeting.go index 22f178b..4bf679c 100644 --- a/cmd/tusd/cli/greeting.go +++ b/cmd/tusd/cli/greeting.go @@ -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) {