Skip to content

Commit 2fbaebf

Browse files
committed
Trim matrix secret when read from file
Treat the secret the same as synapse when read from file a file, so that the same secret file can be reused between mas and synapse. https://github.com/element-hq/synapse/blob/v1.137.0/synapse/config/experimental.py#L50
1 parent 3e72459 commit 2fbaebf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/config/src/sections/matrix.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ impl MatrixConfig {
131131
/// Returns an error when the shared secret could not be read from file.
132132
pub async fn secret(&self) -> anyhow::Result<String> {
133133
Ok(match &self.secret {
134-
Secret::File(path) => tokio::fs::read_to_string(path).await?,
134+
Secret::File(path) => {
135+
let raw = tokio::fs::read_to_string(path).await?;
136+
// Trim the secret when read from file for compatibility with Synapse
137+
raw.trim().to_string()
138+
}
135139
Secret::Value(secret) => secret.clone(),
136140
})
137141
}

0 commit comments

Comments
 (0)