[docs](trx-rs): record the trx-config crate and its commands
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyX26FCpMQxiBoC7r5K1A7 Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -24,6 +24,12 @@ cargo test -p trx-core
|
|||||||
./target/release/trx-server --print-config > trx-server.toml
|
./target/release/trx-server --print-config > trx-server.toml
|
||||||
./target/release/trx-client --print-config > trx-client.toml
|
./target/release/trx-client --print-config > trx-client.toml
|
||||||
|
|
||||||
|
# Validate a config without starting anything (reports every problem)
|
||||||
|
./target/release/trx-server --check-config --config trx-rs.toml
|
||||||
|
|
||||||
|
# Regenerate trx-rs.toml.example after changing a config struct
|
||||||
|
cargo run -p trx-config --example generate_example
|
||||||
|
|
||||||
# Run server
|
# Run server
|
||||||
./target/release/trx-server --config trx-server.toml
|
./target/release/trx-server --config trx-server.toml
|
||||||
# or via CLI args:
|
# or via CLI args:
|
||||||
@@ -41,7 +47,8 @@ This is a Cargo workspace. All crates live under `src/`:
|
|||||||
src/
|
src/
|
||||||
trx-core/ # Core types, traits, state machine, controller (~3,500 LOC)
|
trx-core/ # Core types, traits, state machine, controller (~3,500 LOC)
|
||||||
trx-protocol/ # Client↔server protocol DTOs, auth, codec, mapping (~1,100 LOC)
|
trx-protocol/ # Client↔server protocol DTOs, auth, codec, mapping (~1,100 LOC)
|
||||||
trx-app/ # Shared application helpers (config paths, logging init)
|
trx-app/ # Shared application helpers (logging init, name normalization)
|
||||||
|
trx-config/ # Client + server config structs, loader, validators (~2,500 LOC)
|
||||||
trx-reporting/ # PSKReporter UDP uplink + APRS-IS TCP uplink (~1,150 LOC)
|
trx-reporting/ # PSKReporter UDP uplink + APRS-IS TCP uplink (~1,150 LOC)
|
||||||
trx-server/ # Server binary: rig_task, audio pipeline, listener (~3,700 LOC)
|
trx-server/ # Server binary: rig_task, audio pipeline, listener (~3,700 LOC)
|
||||||
trx-backend/ # Backend abstraction trait + factory + dummy
|
trx-backend/ # Backend abstraction trait + factory + dummy
|
||||||
|
|||||||
@@ -1523,17 +1523,19 @@ url = "remote.example.com:4530"
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_remote_token_file_fills_token() {
|
fn test_remote_token_file_fills_token() {
|
||||||
let f = secret_file("remote-token");
|
let f = secret_file("remote-token");
|
||||||
let mut config = ClientConfig::default();
|
let mut config = ClientConfig {
|
||||||
config.remotes = vec![RemoteEntry {
|
remotes: vec![RemoteEntry {
|
||||||
name: "hf".to_string(),
|
name: "hf".to_string(),
|
||||||
url: "127.0.0.1:4530".to_string(),
|
url: "127.0.0.1:4530".to_string(),
|
||||||
rig_id: None,
|
rig_id: None,
|
||||||
auth: RemoteAuthConfig {
|
auth: RemoteAuthConfig {
|
||||||
token: None,
|
token: None,
|
||||||
token_file: Some(f.path().to_str().unwrap().to_string()),
|
token_file: Some(f.path().to_str().unwrap().to_string()),
|
||||||
},
|
},
|
||||||
poll_interval_ms: 750,
|
poll_interval_ms: 750,
|
||||||
}];
|
}],
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
config.resolve_secrets(None).unwrap();
|
config.resolve_secrets(None).unwrap();
|
||||||
assert_eq!(config.remotes[0].auth.token.as_deref(), Some("remote-token"));
|
assert_eq!(config.remotes[0].auth.token.as_deref(), Some("remote-token"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,7 +196,6 @@ fn annotate(doc: &mut DocumentMut, path: &str, comment: &str) {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::ConfigFile;
|
|
||||||
|
|
||||||
/// The checked-in example must match what the structs produce, so a new
|
/// The checked-in example must match what the structs produce, so a new
|
||||||
/// config field cannot land without showing up in the example.
|
/// config field cannot land without showing up in the example.
|
||||||
|
|||||||
Reference in New Issue
Block a user