Skip to content

Commit 3fa22fc

Browse files
committed
Merge branch '91-default-dbname' into 'master'
feat: add the default dbname to the connection string (platform#91) Closes #91 See merge request postgres-ai/database-lab!124
2 parents ef081b3 + 7239843 commit 3fa22fc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/services/cloning/mode_base.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@ import (
2727
"gitlab.com/postgres-ai/database-lab/pkg/util/pglog"
2828
)
2929

30-
const idleCheckDuration = 5 * time.Minute
30+
const (
31+
idleCheckDuration = 5 * time.Minute
32+
33+
defaultDatabaseName = "postgres"
34+
)
3135

3236
type baseCloning struct {
3337
cloning
@@ -164,8 +168,8 @@ func (c *baseCloning) CreateClone(cloneRequest *types.CloneCreateRequest) (*mode
164168

165169
clone.DB.Port = strconv.FormatUint(uint64(session.Port), 10)
166170
clone.DB.Host = c.Config.AccessHost
167-
clone.DB.ConnStr = fmt.Sprintf("host=%s port=%s user=%s",
168-
clone.DB.Host, clone.DB.Port, clone.DB.Username)
171+
clone.DB.ConnStr = fmt.Sprintf("host=%s port=%s user=%s dbname=%s",
172+
clone.DB.Host, clone.DB.Port, clone.DB.Username, defaultDatabaseName)
169173

170174
// TODO(anatoly): Remove mock data.
171175
clone.Metadata = models.CloneMetadata{

0 commit comments

Comments
 (0)