[relay] Calls: a long-poll on the fetch route, TURN credentials for coturn, wakes every 10 s; the module passes the TURN secret by systemd credential
This commit is contained in:
@@ -65,11 +65,19 @@ async fn main() {
|
||||
});
|
||||
|
||||
let clock: Clock = Arc::new(now);
|
||||
let app = router(AppState::with_waker(
|
||||
store,
|
||||
clock,
|
||||
Waker::new(args.push_loopback),
|
||||
));
|
||||
let mut state = AppState::with_waker(store, clock, Waker::new(args.push_loopback));
|
||||
if let Some(path) = &args.turn_secret_file {
|
||||
// Read once; trailing whitespace from an editor or `echo` is not part of the secret. Never printed.
|
||||
let secret = match std::fs::read(path) {
|
||||
Ok(bytes) if !bytes.trim_ascii().is_empty() => bytes.trim_ascii().to_vec(),
|
||||
_ => {
|
||||
eprintln!("tabellarius-relay: cannot read the TURN secret file");
|
||||
std::process::exit(2);
|
||||
}
|
||||
};
|
||||
state = state.with_turn(tabellarius_relay::turn::Turn::new(secret, args.turn_urls.clone()));
|
||||
}
|
||||
let app = router(state);
|
||||
let shutdown = async {
|
||||
let _ = tokio::signal::ctrl_c().await;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user