revert to net/url in config.go

This commit is contained in:
perennial
2024-09-29 20:09:03 +10:00
parent fe227013c9
commit b3b8d5117c
+5 -3
View File
@@ -10,7 +10,9 @@ import (
"strings"
"time"
"github.com/goware/urlx"
// TODO: figure out how to properly implement urlx
// the implementation in 5f8b659b49 causes config.go to segfault due to a nil pointer dereference when the PIXIVFE_IMAGEPROXY env var is not set
// "github.com/goware/urlx"
"github.com/sethvargo/go-envconfig"
"codeberg.org/vnpower/pixivfe/v2/server/token_manager"
@@ -93,7 +95,7 @@ func parseRevision(revision string) (date, hash string, isDirty bool) {
// validateURL checks if the given URL is valid
func validateURL(urlString string, urlType string) (*url.URL, error) {
parsedURL, err := urlx.Parse(urlString)
parsedURL, err := url.Parse(urlString)
if err != nil {
return nil, err
}
@@ -161,7 +163,7 @@ func (s *ServerConfig) LoadConfig() error {
proxyURL, err := validateURL(s.ProxyServer_staging, "Proxy server")
if err != nil {
log.Printf("[WARNING] Invalid proxy server URL: %v. Falling back to built-in proxy URL.", err)
proxyURL, _ = urlx.Parse(BuiltinProxyUrl) // We know this is valid
proxyURL, _ = url.Parse(BuiltinProxyUrl) // We know this is valid
log.Printf("Proxy server set to: %s\n", BuiltinProxyUrl)
} else {
log.Printf("Proxy server set to: %s\n", proxyURL.String())