Skip to content

Commit 4a5c0a5

Browse files
committed
fix: make interactive project selection the default when no target provided
- Changed init command to trigger select_seren_database() when target is not provided AND --local flag is not set (default behavior) - Updated error message to guide users when --local is used without --target - Fixed README example: removed --local from interactive selection example - Fixed README markdown lint warnings (blank line around list, broken link) - Added postgresql-client to Dockerfile for pg_dump/pg_restore/psql tools
1 parent fa13c2f commit 4a5c0a5

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ LABEL org.opencontainers.image.title="database-replicator" \
2222
org.opencontainers.image.source="https://github.com/serenorg/database-replicator"
2323

2424
RUN apt-get update && \
25-
apt-get install -y --no-install-recommends ca-certificates libssl3 libpq5 && \
25+
apt-get install -y --no-install-recommends ca-certificates libssl3 libpq5 postgresql-client && \
2626
rm -rf /var/lib/apt/lists/* && \
2727
useradd -m replicator
2828

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Replicate any database to PostgreSQL with zero downtime. Supports PostgreSQL, SQ
1919
SerenAI provides managed PostgreSQL databases optimized for AI workloads. When replicating to SerenDB targets, this tool can run your replication jobs on SerenAI's cloud infrastructure - no local resources required.
2020

2121
**Benefits of SerenAI Cloud Execution:**
22+
2223
- No local compute resources needed
2324
- Automatic retry and error handling
2425
- Job monitoring and logging
@@ -32,8 +33,7 @@ With just your API key set, the tool will interactively guide you through select
3233
export SEREN_API_KEY="your-api-key" # Get from console.serendb.com
3334

3435
database-replicator init \
35-
--source "postgresql://user:pass@source:5432/db" \
36-
--local
36+
--source "postgresql://user:pass@source:5432/db"
3737
```
3838

3939
The tool will:
@@ -54,7 +54,7 @@ database-replicator init \
5454
--target "postgresql://user:pass@your-db.serendb.com:5432/db"
5555
```
5656

57-
For local execution (non-SerenDB targets), use the `--local` flag. See [Remote Execution](#remote-execution-serendb-only) for details.
57+
For local execution (non-SerenDB targets), use the `--local` flag. See [Remote Execution](#remote-execution-aws) for details.
5858

5959
---
6060

src/main.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,23 @@ async fn main() -> anyhow::Result<()> {
268268
let mut state = database_replicator::state::load()?;
269269
let mut target = target.or(state.target_url);
270270

271+
// If no target and not forcing local execution, trigger interactive project selection
272+
// This is the default behavior - remote execution with SerenDB target picker
273+
if target.is_none() && !local {
274+
target = Some(database_replicator::interactive::select_seren_database().await?);
275+
}
276+
277+
// If --seren flag explicitly set, validate target is SerenDB
271278
if seren {
272279
if let Some(t) = &target {
273280
if !database_replicator::utils::is_serendb_target(t) {
274281
anyhow::bail!("--seren flag is only compatible with SerenDB targets.");
275282
}
276-
} else {
277-
target = Some(database_replicator::interactive::select_seren_database().await?);
278283
}
279284
}
280285

281286
let target = target.ok_or_else(|| {
282-
anyhow::anyhow!("Target database URL not provided and not set in state. Use `--target` or `database-replicator target set`.")
287+
anyhow::anyhow!("Target database URL not provided. Use `--target` to specify a target database, or remove `--local` to use interactive SerenDB project selection.")
283288
})?;
284289

285290
// Check if CLI filter flags were provided (skip interactive if so)

0 commit comments

Comments
 (0)