fix: remove trailing whitespace from secrets read from secrets file

This commit is contained in:
Charlotte Hartmann Paludo 2025-12-02 12:03:37 +01:00 committed by nex
parent 7345c241a9
commit 862684af28

View file

@ -31,12 +31,13 @@ impl crate::Service for Service {
let turn_secret = config.turn_secret_file.as_ref().map_or_else(
|| config.turn_secret.clone(),
|path| {
std::fs::read_to_string(path).unwrap_or_else(|e| {
|path| match std::fs::read_to_string(path) {
| Ok(secret) => secret.trim().to_owned(),
| Err(e) => {
error!("Failed to read the TURN secret file: {e}");
config.turn_secret.clone()
})
},
},
);
@ -49,7 +50,7 @@ impl crate::Service for Service {
return config.registration_token.clone();
};
Some(token)
Some(token.trim().to_owned())
},
);