mirror of
https://github.com/grafana/grafana.git
synced 2025-01-26 08:16:59 -06:00
Storage Server: Avoid incorrect parsing of connection string (#85293)
Storage Server: avoid incorrect parsing of connection string In storage server, a connection string is generated to connect to the backing database. In case of Postgres, we were generating the string like `"user=grafana pass= host=postgres.example port=4567"`. This triggered an edge case in `pq` (the go postgres driver) to parse `pass` to be equal to `host=postgres.example`, and host being reset to default value. Using single quotes in the connection string fixed this. Signed-off-by: Prem Kumar <prem.saraswat@grafana.com>
This commit is contained in:
parent
28df41fd96
commit
196134b0b4
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
@ -38,6 +38,18 @@
|
||||
"--hg-key=$HGAPIKEY"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Run Storage Server",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"program": "${workspaceFolder}/pkg/cmd/grafana/",
|
||||
"env": {
|
||||
"GF_DEFAULT_TARGET": "storage-server"
|
||||
},
|
||||
"cwd": "${workspaceFolder}",
|
||||
"args": ["server", "target", "--homepath", "${workspaceFolder}", "--packaging", "dev"]
|
||||
},
|
||||
{
|
||||
"name": "Attach to Chrome",
|
||||
"port": 9222,
|
||||
|
@ -69,7 +69,7 @@ func (db *EntityDB) GetEngine() (*xorm.Engine, error) {
|
||||
}
|
||||
|
||||
connectionString := fmt.Sprintf(
|
||||
"user=%s password=%s host=%s port=%s dbname=%s sslmode=%s", // sslcert=%s sslkey=%s sslrootcert=%s",
|
||||
"user='%s' password='%s' host='%s' port='%s' dbname='%s' sslmode='%s'", // sslcert='%s' sslkey='%s' sslrootcert='%s'",
|
||||
dbUser, dbPass, addr.Host, addr.Port, dbName, dbSslMode, // ss.dbCfg.ClientCertPath, ss.dbCfg.ClientKeyPath, ss.dbCfg.CaCertPath
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user