diff --git a/CHANGELOG.md b/CHANGELOG.md index e24aace..0912fbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v0.2.5 - 2024.03.24 +* Rename `config.readConfig` to `config.ReadConfig` +* Assume default values if no `yukari.ini(5)` is loaded + # v0.2.4 - 2024.03.24 * Replace invalid favicon with one sourced from [here](https://en.touhouwiki.net/wiki/File:Th123YukariSigil.png), as well as using `//go:embed` for it * Add rc.d files for FreeBSD and OpenBSD, respectively diff --git a/cmd/yukari/main.go b/cmd/yukari/main.go index b2c6ccf..5b945a0 100644 --- a/cmd/yukari/main.go +++ b/cmd/yukari/main.go @@ -913,16 +913,20 @@ func main() { flag.BoolVar(&version, "version", false, "Show version") flag.Parse() - config.Config.ListenAddress = "127.0.0.1:3000" - config.Config.Key = "" - config.Config.IPV6 = true - config.Config.Debug = false - config.Config.RequestTimeout = 5 - config.Config.FollowRedirect = false - config.Config.UrlParameter = "yukariurl" - config.Config.HashParameter = "yukarihash" - config.Config.MaxConnsPerHost = 5 - config.Config.ProxyEnv = false + if configFile != "" { + config.ReadConfig(configFile) + } else { + config.Config.ListenAddress = "127.0.0.1:3000" + config.Config.Key = "" + config.Config.IPV6 = true + config.Config.Debug = false + config.Config.RequestTimeout = 5 + config.Config.FollowRedirect = false + config.Config.UrlParameter = "yukariurl" + config.Config.HashParameter = "yukarihash" + config.Config.MaxConnsPerHost = 5 + config.Config.ProxyEnv = false + } if version { yukari.FullVersion() diff --git a/config/config.go b/config/config.go index 49b049a..956a819 100644 --- a/config/config.go +++ b/config/config.go @@ -17,7 +17,7 @@ var Config struct { ProxyEnv bool } -func readConfig(file string) error { +func ReadConfig(file string) error { cfg, err := ini.Load(file) if err != nil { return err