Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration file for geoipupdate is actually optional #285

Merged
merged 1 commit into from
Feb 26, 2024
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
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.
marselester marked this conversation as resolved.
Show resolved Hide resolved
Reported by jsf84ksnf. GitHub #284.

## 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 @@ -19,6 +20,13 @@ type Args struct {

func getArgs() *Args {
confFileDefault := vars.DefaultConfigFile
// 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 = ""
}
marselester marked this conversation as resolved.
Show resolved Hide resolved

if value, ok := os.LookupEnv("GEOIPUPDATE_CONF_FILE"); ok {
confFileDefault = value
}
Expand Down
Loading