mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
(cmd): Add --read-only mode flag
This commit is contained in:
parent
c04e63d3f7
commit
3805ae6e06
@ -34,6 +34,7 @@ var (
|
|||||||
flagMaxResultLength int
|
flagMaxResultLength int
|
||||||
flagEnableMetricsExporter bool
|
flagEnableMetricsExporter bool
|
||||||
flagPrometheusServerAddr string
|
flagPrometheusServerAddr string
|
||||||
|
flagReadOnly bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -49,6 +50,7 @@ func init() {
|
|||||||
flag.IntVar(&flagMaxResultLength, "max-result-length", getEnvOrDefaultInt("MAX_RESULT_LENGTH", 200), "maximum number of utf8 characters printed in the result cell in the Web UI")
|
flag.IntVar(&flagMaxResultLength, "max-result-length", getEnvOrDefaultInt("MAX_RESULT_LENGTH", 200), "maximum number of utf8 characters printed in the result cell in the Web UI")
|
||||||
flag.BoolVar(&flagEnableMetricsExporter, "enable-metrics-exporter", getEnvOrDefaultBool("ENABLE_METRICS_EXPORTER", false), "enable prometheus metrics exporter to expose queue metrics")
|
flag.BoolVar(&flagEnableMetricsExporter, "enable-metrics-exporter", getEnvOrDefaultBool("ENABLE_METRICS_EXPORTER", false), "enable prometheus metrics exporter to expose queue metrics")
|
||||||
flag.StringVar(&flagPrometheusServerAddr, "prometheus-addr", getEnvDefaultString("PROMETHEUS_ADDR", ""), "address of prometheus server to query time series")
|
flag.StringVar(&flagPrometheusServerAddr, "prometheus-addr", getEnvDefaultString("PROMETHEUS_ADDR", ""), "address of prometheus server to query time series")
|
||||||
|
flag.BoolVar(&flagReadOnly, "read-only", getEnvOrDefaultBool("READ_ONLY", false), "restrict to read-only mode")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Write test and refactor this code.
|
// TODO: Write test and refactor this code.
|
||||||
@ -114,6 +116,7 @@ func main() {
|
|||||||
PayloadFormatter: asynqmon.PayloadFormatterFunc(formatPayload),
|
PayloadFormatter: asynqmon.PayloadFormatterFunc(formatPayload),
|
||||||
ResultFormatter: asynqmon.ResultFormatterFunc(formatResult),
|
ResultFormatter: asynqmon.ResultFormatterFunc(formatResult),
|
||||||
PrometheusAddress: flagPrometheusServerAddr,
|
PrometheusAddress: flagPrometheusServerAddr,
|
||||||
|
ReadOnly: flagReadOnly,
|
||||||
})
|
})
|
||||||
defer h.Close()
|
defer h.Close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user