Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,11 @@ amtool template render --template.glob='/foo/bar/*.tmpl' --template.text='{{ tem

### Configuration

`amtool` allows a configuration file to specify some options for convenience. The default configuration file paths are `$HOME/.config/amtool/config.yml` or `/etc/amtool/config.yml`
`amtool` allows a configuration file to specify some options for convenience. The default configuration file paths are, in order of precedence:

1. The environment variable `AMTOOL_CONFIG_FILE`, if set.
2. `$HOME/.config/amtool/config.yml`
3. `/etc/amtool/config.yml`

An example configuration file might look like the following:

Expand Down
12 changes: 6 additions & 6 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ var (
httpConfigFile string
versionCheck bool
featureFlags string

configFiles = []string{os.ExpandEnv("$HOME/.config/amtool/config.yml"), "/etc/amtool/config.yml"}
legacyFlags = map[string]string{"comment_required": "require-comment"}
configFiles = []string{os.Getenv("AMTOOL_CONFIG_FILE"), os.ExpandEnv("$HOME/.config/amtool/config.yml"), "/etc/amtool/config.yml"}
legacyFlags = map[string]string{"comment_required": "require-comment"}
)

func initMatchersCompat(_ *kingpin.ParseContext) error {
Expand Down Expand Up @@ -191,9 +190,10 @@ const (
helpRoot = `View and modify the current Alertmanager state.

Config File:
The alertmanager tool will read a config file in YAML format from one of two
default config locations: $HOME/.config/amtool/config.yml or
/etc/amtool/config.yml
The alertmanager tool will read a config file in YAML format from one of the following locations, in order of precedence:
1. The environment variable AMTOOL_CONFIG_FILE, if set.
2. $HOME/.config/amtool/config.yml
3. /etc/amtool/config.yml

All flags can be given in the config file, but the following are the suited for
static configuration:
Expand Down