Skip to content

Commit

Permalink
Introduce SSL flag
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmartinelli committed Jan 20, 2016
1 parent 8977995 commit e982dd1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pgfutter.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ func main() {
Usage: "username",
EnvVar: "DB_USER",
},
cli.BoolFlag{
Name: "ssl",
Usage: "require ssl mode",
},
cli.StringFlag{
Name: "pass, pw",
Value: "",
Expand Down
3 changes: 3 additions & 0 deletions postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ func postgresify(identifier string) string {
//parse sql connection string from cli flags
func parseConnStr(c *cli.Context) string {
otherParams := "sslmode=disable connect_timeout=5"
if c.GlobalBool("ssl") {
otherParams = "sslmode=require connect_timeout=5"
}
return fmt.Sprintf("user=%s dbname=%s password='%s' host=%s port=%s %s",
c.GlobalString("username"),
c.GlobalString("dbname"),
Expand Down

0 comments on commit e982dd1

Please sign in to comment.