From e5c69685b5bb1a9cd19bac4a79470dbc766d509d Mon Sep 17 00:00:00 2001 From: B1F030 Date: Mon, 8 Jul 2024 11:30:36 +0800 Subject: [PATCH 1/4] Fix web.cors.origin in command-line/prometheus.md Signed-off-by: B1F030 --- cmd/prometheus/main.go | 2 +- docs/command-line/prometheus.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 1d844ddba..787a28992 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -343,7 +343,7 @@ func main() { a.Flag("web.page-title", "Document title of Prometheus instance."). Default("Prometheus Time Series Collection and Processing Server").StringVar(&cfg.web.PageTitle) - a.Flag("web.cors.origin", `Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1|domain2)\.com'`). + a.Flag("web.cors.origin", `Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1\|domain2)\.com'`). Default(".*").StringVar(&cfg.corsRegexString) serverOnlyFlag(a, "storage.tsdb.path", "Base path for metrics storage."). diff --git a/docs/command-line/prometheus.md b/docs/command-line/prometheus.md index 223260243..2faf65105 100644 --- a/docs/command-line/prometheus.md +++ b/docs/command-line/prometheus.md @@ -30,7 +30,7 @@ The Prometheus monitoring server | --web.console.templates | Path to the console template directory, available at /consoles. | `consoles` | | --web.console.libraries | Path to the console library directory. | `console_libraries` | | --web.page-title | Document title of Prometheus instance. | `Prometheus Time Series Collection and Processing Server` | -| --web.cors.origin | Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1|domain2)\.com' | `.*` | +| --web.cors.origin | Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1\|domain2)\.com' | `.*` | | --storage.tsdb.path | Base path for metrics storage. Use with server mode only. | `data/` | | --storage.tsdb.retention | [DEPRECATED] How long to retain samples in storage. This flag has been deprecated, use "storage.tsdb.retention.time" instead. Use with server mode only. | | | --storage.tsdb.retention.time | How long to retain samples in storage. When this flag is set it overrides "storage.tsdb.retention". If neither this flag nor "storage.tsdb.retention" nor "storage.tsdb.retention.size" is set, the retention time defaults to 15d. Units Supported: y, w, d, h, m, s, ms. Use with server mode only. | | From 5c2590c358311c22aa995fd524e3b5d23f51f71d Mon Sep 17 00:00:00 2001 From: B1F030 Date: Mon, 15 Jul 2024 10:54:54 +0800 Subject: [PATCH 2/4] revert main.go Signed-off-by: B1F030 --- cmd/prometheus/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/prometheus/main.go b/cmd/prometheus/main.go index 787a28992..1d844ddba 100644 --- a/cmd/prometheus/main.go +++ b/cmd/prometheus/main.go @@ -343,7 +343,7 @@ func main() { a.Flag("web.page-title", "Document title of Prometheus instance."). Default("Prometheus Time Series Collection and Processing Server").StringVar(&cfg.web.PageTitle) - a.Flag("web.cors.origin", `Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1\|domain2)\.com'`). + a.Flag("web.cors.origin", `Regex for CORS origin. It is fully anchored. Example: 'https?://(domain1|domain2)\.com'`). Default(".*").StringVar(&cfg.corsRegexString) serverOnlyFlag(a, "storage.tsdb.path", "Base path for metrics storage."). From 15ac95ddd07b607914fb7d04c26f2231aadf25b5 Mon Sep 17 00:00:00 2001 From: B1F030 Date: Mon, 15 Jul 2024 11:33:58 +0800 Subject: [PATCH 3/4] change documentcli Signed-off-by: B1F030 --- util/documentcli/documentcli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/documentcli/documentcli.go b/util/documentcli/documentcli.go index 720a7c9c7..b3f143cf6 100644 --- a/util/documentcli/documentcli.go +++ b/util/documentcli/documentcli.go @@ -75,7 +75,7 @@ func createFlagRow(flag *kingpin.FlagModel) []string { name = fmt.Sprintf(`-%c, --%s`, flag.Short, flag.Name) } - return []string{name, flag.Help, defaultVal} + return []string{name, strings.ReplaceAll(flag.Help, "|", "\|"), defaultVal} } func writeFlagTable(writer io.Writer, level int, fgm *kingpin.FlagGroupModel) error { From 3648386345f76f7fc00b3d0dd68b2e0f8e9b4a42 Mon Sep 17 00:00:00 2001 From: B1F030 Date: Mon, 15 Jul 2024 11:59:58 +0800 Subject: [PATCH 4/4] fix fmt Signed-off-by: B1F030 --- util/documentcli/documentcli.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/documentcli/documentcli.go b/util/documentcli/documentcli.go index b3f143cf6..9de2bb8d4 100644 --- a/util/documentcli/documentcli.go +++ b/util/documentcli/documentcli.go @@ -75,7 +75,7 @@ func createFlagRow(flag *kingpin.FlagModel) []string { name = fmt.Sprintf(`-%c, --%s`, flag.Short, flag.Name) } - return []string{name, strings.ReplaceAll(flag.Help, "|", "\|"), defaultVal} + return []string{name, strings.ReplaceAll(flag.Help, "|", `\|`), defaultVal} } func writeFlagTable(writer io.Writer, level int, fgm *kingpin.FlagGroupModel) error {