mirror of
https://github.com/prometheus/alertmanager
synced 2025-04-21 14:36:10 +00:00
Fixes #831 Move config file to a more consistent location and update docs
This commit is contained in:
parent
ffe79ad410
commit
305263e462
15
cli/root.go
15
cli/root.go
@ -17,8 +17,13 @@ var RootCmd = &cobra.Command{
|
|||||||
|
|
||||||
[Config File]
|
[Config File]
|
||||||
|
|
||||||
The alertmanager tool will read a config file from the --config cli argument, AMTOOL_CONFIG environment variable,
|
The alertmanager tool will read a config file from the --config cli argument, AMTOOL_CONFIG environment variable or
|
||||||
$HOME/.amtool.yml or /etc/amtool.yml the options are as follows
|
from one of two default config locations. Valid config file formats are JSON, TOML, YAML, HCL and Java Properties, use
|
||||||
|
whatever makes sense for your project.
|
||||||
|
|
||||||
|
The default config file paths are $HOME/.config/amtool/config.yml or /etc/amtool/config.yml
|
||||||
|
|
||||||
|
The accepted config options are as follows:
|
||||||
|
|
||||||
alertmanager.url
|
alertmanager.url
|
||||||
Set a default alertmanager url for each request
|
Set a default alertmanager url for each request
|
||||||
@ -58,9 +63,9 @@ func init() {
|
|||||||
|
|
||||||
// initConfig reads in config file and ENV variables if set.
|
// initConfig reads in config file and ENV variables if set.
|
||||||
func initConfig() {
|
func initConfig() {
|
||||||
viper.SetConfigName(".amtool") // name of config file (without extension)
|
viper.SetConfigName("config") // name of config file (without extension)
|
||||||
viper.AddConfigPath("/etc")
|
viper.AddConfigPath("/etc/amtool")
|
||||||
viper.AddConfigPath("$HOME")
|
viper.AddConfigPath("$HOME/.config/amtool")
|
||||||
viper.SetEnvPrefix("AMTOOL")
|
viper.SetEnvPrefix("AMTOOL")
|
||||||
viper.AutomaticEnv() // read in environment variables that match
|
viper.AutomaticEnv() // read in environment variables that match
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user