Skip to content

Commit

Permalink
Don't use HOME env in the my-cnf config (#745)
Browse files Browse the repository at this point in the history
* Don't use HOME env in the my-cnf config

Use a relative file as the default for the .my.cnf style configuration.

Fixes: #633

---------

Signed-off-by: SuperQ <superq@gmail.com>
Signed-off-by: Ben Kochie <superq@gmail.com>
Co-authored-by: Matthias Rampke <matthias.rampke@googlemail.com>
  • Loading branch information
SuperQ and matthiasr committed Jun 22, 2023
1 parent 2b7699b commit 931b76d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

BREAKING CHANGES:

The default client configuration file is now `.my.cnf` in the process working directory. Use `--config.my-cnf="$HOME/.my.cnf"` to retain the previous default.

Changes:

* [CHANGE] Don't use HOME env in the my-cnf config path. #745

* [CHANGE]
* [FEATURE]
* [ENHANCEMENT]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ NOTE: It is recommended to set a max connection limit for the user to avoid over

##### Single exporter mode

Running using ~/.my.cnf:
Running using `.my.cnf` from the current directory:

./mysqld_exporter <flags>

Expand Down
3 changes: 1 addition & 2 deletions mysqld_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"context"
"net/http"
"os"
"path"
"strconv"
"time"

Expand Down Expand Up @@ -48,7 +47,7 @@ var (
configMycnf = kingpin.Flag(
"config.my-cnf",
"Path to .my.cnf file to read MySQL credentials from.",
).Default(path.Join(os.Getenv("HOME"), ".my.cnf")).String()
).Default(".my.cnf").String()
mysqldAddress = kingpin.Flag(
"mysqld.address",
"Address to use for connecting to MySQL",
Expand Down

0 comments on commit 931b76d

Please sign in to comment.