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

Config.URL() constructs invalid URL #27

Open
ptman opened this issue Jan 15, 2025 · 0 comments · May be fixed by #28
Open

Config.URL() constructs invalid URL #27

ptman opened this issue Jan 15, 2025 · 0 comments · May be fixed by #28

Comments

@ptman
Copy link

ptman commented Jan 15, 2025

PG connstring: host=/run/postgresql dbname=foo
Working pg URL: postgres:///foo?host=/run/postgresql
URL by Config.URL(): postgres://ptman:@/run/postgresql:5432/foo?

the Config is constructed from ConnConfig by https://pkg.go.dev/github.com/jackc/pgx/v5#ParseConfig

func (c Config) URL() string {

I was able to get it working with:

        cfg := pgtestdb.Config{                                              
                //Host:       conf.ParsedDB.ConnConfig.Host,
                //Port:     strconv.Itoa(int(conf.ParsedDB.ConnConfig.Port)),
                DriverName: "pgx",                            
                Database:   conf.ParsedDB.ConnConfig.Database,               
                User:       conf.ParsedDB.ConnConfig.User,                 
                Password:   conf.ParsedDB.ConnConfig.Password,             
                Options:    "host=/run/postgresql",
        }
@hallabro hallabro linked a pull request Jan 30, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant