Skip to content

Commit 2c2cf7e

Browse files
ndbroadbentclaude
andcommitted
Add dev-server feature flag for local development
- Add `dev-server` Cargo feature to switch between localhost and production API - Update Taskfile with `task dev` (dev server) and `task dev:prod` (prod API) - Add `task build:dev` for testing release builds against local server 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 0f73bbb commit 2c2cf7e

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

Taskfile.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,25 @@ tasks:
88

99
# === Development ===
1010
dev:
11-
desc: Start Tauri development mode
11+
desc: Start Tauri dev mode (points to localhost:5173)
12+
cmds:
13+
- cargo tauri dev --features dev-server
14+
15+
dev:prod:
16+
desc: Start Tauri dev mode (points to production API)
1217
cmds:
1318
- cargo tauri dev
1419

1520
build:
16-
desc: Build for production
21+
desc: Build for production (points to chattomap.com)
1722
cmds:
1823
- cargo tauri build
1924

25+
build:dev:
26+
desc: Build release with dev server (for testing)
27+
cmds:
28+
- cargo tauri build --features dev-server
29+
2030
# === Quality Checks (run before marking any task complete) ===
2131
ci:
2232
desc: Run all CI checks

src-tauri/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ path = "src/cli.rs"
4949
[features]
5050
default = ["desktop"]
5151
desktop = ["tauri", "tauri-plugin-shell", "tauri/custom-protocol"]
52+
# Use local dev server instead of production
53+
dev-server = []
5254

5355
[profile.release]
5456
panic = "abort"

src-tauri/src/upload.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ pub type UploadProgressCallback = Box<dyn Fn(u8, String) + Send + Sync>;
4747
// Configuration
4848
// =============================================================================
4949

50-
/// Server base URL
51-
#[cfg(debug_assertions)]
52-
const SERVER_BASE_URL: &str = "http://localhost:5173";
50+
/// Server base URL - use `--features dev-server` to point to localhost
51+
#[cfg(feature = "dev-server")]
52+
pub const SERVER_BASE_URL: &str = "http://localhost:5173";
5353

54-
#[cfg(not(debug_assertions))]
55-
const SERVER_BASE_URL: &str = "https://chattomap.com";
54+
#[cfg(not(feature = "dev-server"))]
55+
pub const SERVER_BASE_URL: &str = "https://chattomap.com";
5656

5757
// =============================================================================
5858
// Upload Implementation

0 commit comments

Comments
 (0)