Use simple connection string in config

This commit is contained in:
2022-02-09 21:57:40 +00:00
parent 2c71c521f9
commit e934d407c2
3 changed files with 6 additions and 18 deletions

View File

@ -18,8 +18,7 @@ type Database struct {
}
// Connect to a database
func Connect(server string, user string, password string, database string) (*Database, error) {
connString := fmt.Sprintf("postgres://%s:%s@%s/%s", user, password, server, database)
func Connect(connString string) (*Database, error) {
conn, err := sql.Open("pgx", connString)
if err != nil {
return nil, fmt.Errorf("open connection: %w", err)