mirror of
https://github.com/gofiber/storage.git
synced 2025-10-05 08:37:10 +08:00
✨ feature: integrate SSL mode for PG connections (#77)
Right now, the default connection for postgres is `disable`. Some databases require `verify` or even `required`. This PR introduces a new implementation that allows the user to override the `disable` mode. The PR keeps a backwards compatible config entry, that sets the default behavior to `disable` if it's missing.
This commit is contained in:
@@ -57,9 +57,10 @@ func New(config ...Config) *Storage {
|
||||
dsn += "@"
|
||||
}
|
||||
dsn += fmt.Sprintf("%s:%d", url.QueryEscape(cfg.Host), cfg.Port)
|
||||
dsn += fmt.Sprintf("/%s?connect_timeout=%d&sslmode=disable",
|
||||
dsn += fmt.Sprintf("/%s?connect_timeout=%d&sslmode=%s",
|
||||
url.QueryEscape(cfg.Database),
|
||||
int64(cfg.timeout.Seconds()),
|
||||
cfg.SslMode,
|
||||
)
|
||||
|
||||
// Create db
|
||||
|
Reference in New Issue
Block a user