fix: remove trailing whitespace from secrets read from secrets file

This commit is contained in:
Charlotte Hartmann Paludo
2025-12-13 16:07:51 +00:00
committed by nex
parent 7345c241a9
commit 862684af28
+5 -4
View File
@@ -31,12 +31,13 @@ impl crate::Service for Service {
let turn_secret = config.turn_secret_file.as_ref().map_or_else( let turn_secret = config.turn_secret_file.as_ref().map_or_else(
|| config.turn_secret.clone(), || config.turn_secret.clone(),
|path| { |path| match std::fs::read_to_string(path) {
std::fs::read_to_string(path).unwrap_or_else(|e| { | Ok(secret) => secret.trim().to_owned(),
| Err(e) => {
error!("Failed to read the TURN secret file: {e}"); error!("Failed to read the TURN secret file: {e}");
config.turn_secret.clone() config.turn_secret.clone()
}) },
}, },
); );
@@ -49,7 +50,7 @@ impl crate::Service for Service {
return config.registration_token.clone(); return config.registration_token.clone();
}; };
Some(token) Some(token.trim().to_owned())
}, },
); );