Skip to content

Commit e65eed3

Browse files
Use admin credentials with use command
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent e25f665 commit e65eed3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

providers/proxysql/proxysql.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ func (p *ProxySQLProvider) CreateSandbox(config providers.SandboxConfig) (*provi
112112
pidFile),
113113
}
114114
if config.Options["backend_provider"] == "postgresql" {
115-
psqlURI := func(port int) string {
116-
return fmt.Sprintf("postgresql://%s:%s@%s:%d", monitorUser, monitorPass, host, port)
115+
psqlURI := func(user, password string, port int) string {
116+
return fmt.Sprintf("postgresql://%s:%s@%s:%d", user, password, host, port)
117117
}
118-
scripts["use"] = fmt.Sprintf("#!/bin/bash\npsql %s \"$@\"\n", psqlURI(adminPort))
119-
scripts["use_proxy"] = fmt.Sprintf("#!/bin/bash\npsql %s \"$@\"\n", psqlURI(mysqlPort))
118+
scripts["use"] = fmt.Sprintf("#!/bin/bash\npsql %s \"$@\"\n", psqlURI(adminUser, adminPassword, adminPort))
119+
scripts["use_proxy"] = fmt.Sprintf("#!/bin/bash\npsql %s \"$@\"\n", psqlURI(monitorUser, monitorPass, mysqlPort))
120120
} else {
121121
scripts["use"] = fmt.Sprintf("#!/bin/bash\nmysql -h %s -P %d -u %s -p%s --prompt 'ProxySQL Admin> ' \"$@\"\n",
122122
host, adminPort, adminUser, adminPassword)

0 commit comments

Comments
 (0)