diff --git a/app/vmalert/README.md b/app/vmalert/README.md index 4be872e14..9e8ad625a 100644 --- a/app/vmalert/README.md +++ b/app/vmalert/README.md @@ -588,6 +588,9 @@ The shortlist of configuration flags is the following: -notifier.basicAuth.password array Optional basic auth password for -notifier.url Supports an array of values separated by comma or specified via multiple flags. + -notifier.basicAuth.passwordFile array + Optional path to basic auth password file for -notifier.url + Supports an array of values separated by comma or specified via multiple flags. -notifier.basicAuth.username array Optional basic auth username for -notifier.url Supports an array of values separated by comma or specified via multiple flags. diff --git a/app/vmalert/notifier/init.go b/app/vmalert/notifier/init.go index 633cbfb24..d550de2fc 100644 --- a/app/vmalert/notifier/init.go +++ b/app/vmalert/notifier/init.go @@ -15,9 +15,10 @@ var ( configPath = flag.String("notifier.config", "", "Path to configuration file for notifiers") suppressDuplicateTargetErrors = flag.Bool("notifier.suppressDuplicateTargetErrors", false, "Whether to suppress 'duplicate target' errors during discovery") - addrs = flagutil.NewArray("notifier.url", "Prometheus alertmanager URL, e.g. http://127.0.0.1:9093") - basicAuthUsername = flagutil.NewArray("notifier.basicAuth.username", "Optional basic auth username for -notifier.url") - basicAuthPassword = flagutil.NewArray("notifier.basicAuth.password", "Optional basic auth password for -notifier.url") + addrs = flagutil.NewArray("notifier.url", "Prometheus alertmanager URL, e.g. http://127.0.0.1:9093") + basicAuthUsername = flagutil.NewArray("notifier.basicAuth.username", "Optional basic auth username for -notifier.url") + basicAuthPassword = flagutil.NewArray("notifier.basicAuth.password", "Optional basic auth password for -notifier.url") + basicAuthPasswordFile = flagutil.NewArray("notifier.basicAuth.passwordFile", "Optional path to basic auth password file for -notifier.url") tlsInsecureSkipVerify = flagutil.NewArrayBool("notifier.tlsInsecureSkipVerify", "Whether to skip tls verification when connecting to -notifier.url") tlsCertFile = flagutil.NewArray("notifier.tlsCertFile", "Optional path to client-side TLS certificate file to use when connecting to -notifier.url") @@ -90,8 +91,9 @@ func notifiersFromFlags(gen AlertURLGenerator) ([]Notifier, error) { InsecureSkipVerify: tlsInsecureSkipVerify.GetOptionalArg(i), }, BasicAuth: &promauth.BasicAuthConfig{ - Username: basicAuthUsername.GetOptionalArg(i), - Password: promauth.NewSecret(basicAuthPassword.GetOptionalArg(i)), + Username: basicAuthUsername.GetOptionalArg(i), + Password: promauth.NewSecret(basicAuthPassword.GetOptionalArg(i)), + PasswordFile: basicAuthPasswordFile.GetOptionalArg(i), }, } addr = strings.TrimSuffix(addr, "/")