Skip to content

Commit

Permalink
fix: encode query parameters in migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed Mar 21, 2024
1 parent 545c15d commit 06b90fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/bolt-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,9 @@ jobs:
- name: Bolt Test
run: nix-shell --pure --run "bolt test"

- name: Tmate
if: failure()
uses: mxschmitt/action-tmate@v3

# - name: K3D Cleanup
# if: always()
# run: nix-shell --pure --run "k3d cluster delete rivet-ci"
- name: K3D Cleanup
if: always()
run: nix-shell --pure --run "k3d cluster delete rivet-ci"

- name: Force Parallel Failure
if: failure()
Expand Down
12 changes: 10 additions & 2 deletions lib/bolt/core/src/utils/db_conn.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::{collections::HashMap, sync::Arc};
use urlencoding::encode;

use anyhow::*;

Expand Down Expand Up @@ -179,7 +180,10 @@ impl DatabaseConnections {

Ok(format!(
"cockroach://{}:{}@{}/{}?sslmode=verify-ca&sslrootcert=/local/crdb-ca.crt",
username, password, host, full_db_name
encode(&username),
encode(&password),
host,
encode(&full_db_name),
))
}
RuntimeKind::ClickHouse { .. } => {
Expand All @@ -196,7 +200,11 @@ impl DatabaseConnections {

Ok(format!(
"clickhouse://{}/?database={}&username={}&password={}{}",
host, db_name, clickhouse_user, clickhouse_password, query_other
host,
encode(&db_name),
encode(&clickhouse_user),
encode(&clickhouse_password),
query_other,
))
}
x @ _ => bail!("cannot migrate this type of service: {x:?}"),
Expand Down

0 comments on commit 06b90fd

Please sign in to comment.