mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-15 03:36:33 +03:00
Check if provided connection URL has invalid format
This commit is contained in:
parent
dd1127ff77
commit
12bdc36c92
5
main.go
5
main.go
@ -42,6 +42,11 @@ func getConnectionString() string {
|
||||
if options.Url != "" {
|
||||
url := options.Url
|
||||
|
||||
if strings.Contains(url, "postgresql://") {
|
||||
fmt.Println("Invalid URL format. It should match: postgres://user:password@host:port/db?sslmode=mode")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if options.Ssl != "" && !strings.Contains(url, "sslmode") {
|
||||
url += fmt.Sprintf("?sslmode=%s", options.Ssl)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user