Skip to content

Commit eea67b1

Browse files
committed
fix: Handle SerenDB URLs without embedded UUID hostnames
When a SerenDB target URL does not have the expected <database>.<branch>.<project>.serendb.com format with 36-char UUIDs, the remote execution now gracefully falls back to using just the connection string instead of erroring out. This allows users to specify SerenDB targets with simpler hostnames while still benefiting from cloud execution.
1 parent ef50b06 commit eea67b1

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

src/main.rs

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,15 +1009,26 @@ async fn init_remote(
10091009
Some(target.clone()), // Pass the connection string for remote API
10101010
)
10111011
} else if database_replicator::utils::is_serendb_target(&target) {
1012-
let (p_id, b_id, _) = database_replicator::utils::parse_serendb_url_for_ids(&target)
1013-
.context("Failed to parse SerenDB target URL for project, branch, and database IDs.")?;
1014-
(
1015-
Some(p_id),
1016-
Some(b_id),
1017-
None,
1018-
SerenTargetMode::Url,
1019-
Some(target.clone()),
1020-
)
1012+
// Try to extract project/branch IDs from the URL hostname
1013+
// Format: <database-id>.<branch-id>.<project-id>.serendb.com
1014+
// If the URL doesn't have this format, proceed without IDs
1015+
if let Some((p_id, b_id, _)) =
1016+
database_replicator::utils::parse_serendb_url_for_ids(&target)
1017+
{
1018+
(
1019+
Some(p_id),
1020+
Some(b_id),
1021+
None,
1022+
SerenTargetMode::Url,
1023+
Some(target.clone()),
1024+
)
1025+
} else {
1026+
// SerenDB URL without embedded IDs - proceed with just the connection string
1027+
tracing::debug!(
1028+
"SerenDB target URL doesn't contain embedded project/branch IDs, proceeding with connection string only"
1029+
);
1030+
(None, None, None, SerenTargetMode::Url, Some(target.clone()))
1031+
}
10211032
} else {
10221033
(None, None, None, SerenTargetMode::Url, Some(target.clone()))
10231034
};

0 commit comments

Comments
 (0)