package db import ( "context" "github.com/jackc/pgx/v4/pgxpool" "os" ) var Db *pgxpool.Pool func Connect(connStr string) error { if connStr == "" { connStr = os.Getenv("QDDNS_DB") } if connStr == "" { connStr = "postgresql:///pdns" } conn, err := pgxpool.Connect(context.Background(), connStr) if err != nil { return err } Db = conn return nil }