Skip to content

Commit 92a5094

Browse files
committed
fix(ostool): align default board server with ostool-server port
1 parent 6cfa173 commit 92a5094

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ baud_rate = "${env:BAUD_RATE:-115200}"
307307

308308
```toml
309309
[board]
310-
server = "http://localhost"
310+
server = "http://localhost:2999"
311311
auth_mode = "disabled"
312312
```
313313

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ baud_rate = "${env:BAUD_RATE:-115200}"
304304

305305
```toml
306306
[board]
307-
server = "http://localhost"
307+
server = "http://localhost:2999"
308308
auth_mode = "disabled"
309309
```
310310

ostool/src/board/global_config.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ use reqwest::Url;
99
use schemars::JsonSchema;
1010
use serde::{Deserialize, Serialize};
1111

12-
pub const DEFAULT_BOARD_SERVER: &str = "http://localhost";
12+
// Keep the URL-based configuration aligned with ostool-server's established
13+
// default listen port so a newly generated config works without user edits.
14+
pub const DEFAULT_BOARD_SERVER: &str = "http://localhost:2999";
1315

1416
#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, PartialEq, Eq, Default)]
1517
#[serde(rename_all = "snake_case")]
@@ -221,13 +223,25 @@ mod tests {
221223
let loaded = LoadedBoardGlobalConfig::load_or_create_at(&path).unwrap();
222224

223225
assert!(loaded.created);
224-
assert_eq!(loaded.board.server, "http://localhost");
226+
assert_eq!(loaded.board.server, "http://localhost:2999");
225227
assert_eq!(loaded.board.port, None);
226228
let content = std::fs::read_to_string(&path).unwrap();
227-
assert!(content.contains("server = \"http://localhost\""));
229+
assert!(content.contains("server = \"http://localhost:2999\""));
228230
assert!(!content.contains("server_ip"));
229231
}
230232

233+
#[test]
234+
fn default_config_resolves_to_the_board_server_default_port() {
235+
assert_eq!(
236+
BoardGlobalConfig::default()
237+
.resolve_endpoint(None, None)
238+
.unwrap()
239+
.base_url
240+
.as_str(),
241+
"http://localhost:2999/"
242+
);
243+
}
244+
231245
#[test]
232246
fn resolve_endpoint_uses_url_port_or_scheme_default() {
233247
let config = BoardGlobalConfig {

0 commit comments

Comments
 (0)