trim token-file contents

Any ordinary file will contain at least a trailing newline which cannot
be included in the bearer header. Trim all leading/trailing whitespace.
This commit is contained in:
Sarah Brofeldt 2024-05-15 08:17:59 +02:00
parent 4dbdbee457
commit a2a2011b5f

View file

@ -81,6 +81,7 @@ impl ServerTokenConfig {
match self {
ServerTokenConfig::Raw { token } => Ok(token.clone()),
ServerTokenConfig::File { token_file } => Ok(read_to_string(token_file)
.map(|t| t.trim().to_string())
.with_context(|| format!("Failed to read token from {token_file}"))?),
}
}