Skip to content

Commit 4b48827

Browse files
Update internal/config/config.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 815ec70 commit 4b48827

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

internal/config/config.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,9 @@ func Load(cmd *cobra.Command) (*Config, error) {
237237
if dbURL := cfg.Database.URL; dbURL != "" {
238238
if parsed, err := url.Parse(dbURL); err == nil {
239239
host := parsed.Hostname()
240-
if host != "localhost" && host != "127.0.0.1" && host != "::1" {
240+
ip := net.ParseIP(host)
241+
isLoopback := host != "" && (strings.EqualFold(host, "localhost") || (ip != nil && ip.IsLoopback()))
242+
if !isLoopback {
241243
q := parsed.Query()
242244
if q.Get("sslmode") == "prefer" {
243245
log.Printf("WARNING: database URL uses sslmode=prefer for non-loopback host %q; consider sslmode=require for production", host)

0 commit comments

Comments
 (0)