Skip to content

Commit

Permalink
Configuration file for geoipupdate is actually optional
Browse files Browse the repository at this point in the history
  • Loading branch information
marselester committed Feb 23, 2024
1 parent 388c52b commit 45908fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
such as HTTP2 INTERNAL_ERROR.
* `HTTPReader` no longer retries on HTTP errors and therefore
`retryFor` was removed from `NewHTTPReader`.
* Now `geoipupdate` doesn't requires the user to specify the config file
even if all the other arguments are set via the environment variables.

## 6.1.0 (2024-01-09)

Expand Down
8 changes: 8 additions & 0 deletions cmd/geoipupdate/args.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"log"
"os"

Expand All @@ -23,6 +24,13 @@ func getArgs() *Args {
confFileDefault = value
}

// Set the default config file only if it exists.
// Othwerwise, geoipupdate requires the user to specify the config file
// even if all the other arguments are set via the environment variables.
if _, err := os.Stat(confFileDefault); errors.Is(err, os.ErrNotExist) {
confFileDefault = ""
}

configFile := flag.StringP(
"config-file",
"f",
Expand Down

0 comments on commit 45908fa

Please sign in to comment.