| 95 | ) |
| 96 | |
| 97 | func (c *Cluster) pgConnectionString(dbname string) string { |
| 98 | password := c.systemUsers[constants.SuperuserKeyName].Password |
| 99 | |
| 100 | if dbname == "" { |
| 101 | dbname = "postgres" |
| 102 | } |
| 103 | |
| 104 | return fmt.Sprintf("host='%s' dbname='%s' sslmode=require user='%s' password='%s' connect_timeout='%d'", |
| 105 | fmt.Sprintf("%s.%s.svc.%s", c.Name, c.Namespace, c.OpConfig.ClusterDomain), |
| 106 | dbname, |
| 107 | c.systemUsers[constants.SuperuserKeyName].Name, |
| 108 | strings.Replace(password, "$", "\\$", -1), |
| 109 | constants.PostgresConnectTimeout/time.Second) |
| 110 | } |
| 111 | |
| 112 | func (c *Cluster) databaseAccessDisabled() bool { |
| 113 | if !c.OpConfig.EnableDBAccess { |