Url Escape the password provided to postgres

This commit is contained in:
Juan Calderon
2022-12-10 22:14:35 -08:00
parent f681dcebfb
commit 4d9108e34d
2 changed files with 3 additions and 3 deletions

View File

@@ -16,7 +16,7 @@ jobs:
env: env:
POSTGRES_DB: fiber POSTGRES_DB: fiber
POSTGRES_USER: username POSTGRES_USER: username
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: "pass#w%rd"
options: >- options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5 --health-retries 5
@@ -57,4 +57,4 @@ jobs:
env: env:
POSTGRES_DATABASE: fiber POSTGRES_DATABASE: fiber
POSTGRES_USERNAME: username POSTGRES_USERNAME: username
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: "pass#w%rd"

View File

@@ -55,7 +55,7 @@ func New(config ...Config) *Storage {
dsn += url.QueryEscape(cfg.Username) dsn += url.QueryEscape(cfg.Username)
} }
if cfg.Password != "" { if cfg.Password != "" {
dsn += ":" + cfg.Password dsn += ":" + url.QueryEscape(cfg.Password)
} }
if cfg.Username != "" || cfg.Password != "" { if cfg.Username != "" || cfg.Password != "" {
dsn += "@" dsn += "@"