Skip to content

Commit

Permalink
fix: escaping postgresql password
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone committed Jul 1, 2022
1 parent 6916b93 commit 3ba8ac1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api-server/services/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"database/sql"
"fmt"
"log"
"net/url"
"os"
"strings"
"sync"
Expand Down Expand Up @@ -79,9 +80,10 @@ func getPgHost() string {

// nolint: unparam
func getDBURI() (string, error) {
password := url.QueryEscape(config.YataiConfig.Postgresql.Password)
uri := fmt.Sprintf("postgres://%s:%s@%s:%d/%s?sslmode=disable",
config.YataiConfig.Postgresql.User,
config.YataiConfig.Postgresql.Password,
password,
getPgHost(),
config.YataiConfig.Postgresql.Port,
config.YataiConfig.Postgresql.Database)
Expand Down

0 comments on commit 3ba8ac1

Please sign in to comment.