1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-04 02:18:00 +01:00

Avoid some to_string in the request logging and include message to disable web vault when not found.

Dieser Commit ist enthalten in:
Daniel García 2019-12-29 15:29:46 +01:00
Ursprung 8ee0c57224
Commit 36ae946655
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: FC8A7D14C3CD543A
2 geänderte Dateien mit 12 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -225,7 +225,9 @@ fn check_web_vault() {
let index_path = Path::new(&CONFIG.web_vault_folder()).join("index.html"); let index_path = Path::new(&CONFIG.web_vault_folder()).join("index.html");
if !index_path.exists() { if !index_path.exists() {
error!("Web vault is not found. To install it, please follow the steps in https://github.com/dani-garcia/bitwarden_rs/wiki/Building-binary#install-the-web-vault"); error!("Web vault is not found. To install it, please follow the steps in: ");
error!("https://github.com/dani-garcia/bitwarden_rs/wiki/Building-binary#install-the-web-vault");
error!("You can also set the environment variable 'WEB_VAULT_ENABLED=false' to disable it");
exit(1); exit(1);
} }
} }

Datei anzeigen

@ -151,11 +151,13 @@ impl Fairing for BetterLogging {
if !self.0 && method == Method::Options { if !self.0 && method == Method::Options {
return; return;
} }
let mut uri = request.uri().to_string(); let uri = request.uri();
uri.truncate(50); let uri_path = uri.path();
if self.0 || LOGGED_ROUTES.iter().any(|r| uri_path.starts_with(r)) {
if self.0 || LOGGED_ROUTES.iter().any(|r| uri.starts_with(r)) { match uri.query() {
info!(target: "request", "{} {}", method, uri); Some(q) => info!(target: "request", "{} {}?{}", method, uri_path, &q[..q.len().min(30)]),
None => info!(target: "request", "{} {}", method, uri_path),
};
} }
} }
@ -163,8 +165,8 @@ impl Fairing for BetterLogging {
if !self.0 && request.method() == Method::Options { if !self.0 && request.method() == Method::Options {
return; return;
} }
let uri = request.uri().to_string(); let uri_path = request.uri().path();
if self.0 || LOGGED_ROUTES.iter().any(|r| uri.starts_with(r)) { if self.0 || LOGGED_ROUTES.iter().any(|r| uri_path.starts_with(r)) {
let status = response.status(); let status = response.status();
if let Some(ref route) = request.route() { if let Some(ref route) = request.route() {
info!(target: "response", "{} => {} {}", route, status.code, status.reason) info!(target: "response", "{} => {} {}", route, status.code, status.reason)