refactor: removed all imports of the log crate
This commit is contained in:
parent
28d3d03661
commit
7c6a5445c2
|
@ -1,7 +1,6 @@
|
||||||
use crate::backend::Backend;
|
use crate::backend::Backend;
|
||||||
use actix_web::{post, web, HttpResponse, Responder};
|
use actix_web::{post, web, HttpResponse, Responder};
|
||||||
use actix_web_httpauth::extractors::bearer::BearerAuth;
|
use actix_web_httpauth::extractors::bearer::BearerAuth;
|
||||||
use log::error;
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
@ -13,7 +12,7 @@ struct NewResponse {
|
||||||
pub async fn new(backend: web::Data<Backend>, auth: BearerAuth) -> impl Responder {
|
pub async fn new(backend: web::Data<Backend>, auth: BearerAuth) -> impl Responder {
|
||||||
match backend.create_invite_token(auth.token()).await {
|
match backend.create_invite_token(auth.token()).await {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("{e}");
|
log::error!("{e}");
|
||||||
HttpResponse::InternalServerError().finish()
|
HttpResponse::InternalServerError().finish()
|
||||||
}
|
}
|
||||||
Ok(res) => match res {
|
Ok(res) => match res {
|
||||||
|
|
|
@ -3,7 +3,6 @@ pub mod relay_id;
|
||||||
use crate::backend::Backend;
|
use crate::backend::Backend;
|
||||||
use actix_web::{post, web, HttpResponse, Responder};
|
use actix_web::{post, web, HttpResponse, Responder};
|
||||||
use actix_web_httpauth::extractors::bearer::BearerAuth;
|
use actix_web_httpauth::extractors::bearer::BearerAuth;
|
||||||
use log::error;
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
|
@ -16,7 +15,7 @@ struct CreateResponse {
|
||||||
pub async fn create(backend: web::Data<Backend>, auth: BearerAuth) -> impl Responder {
|
pub async fn create(backend: web::Data<Backend>, auth: BearerAuth) -> impl Responder {
|
||||||
match backend.create_relay(auth.token()).await {
|
match backend.create_relay(auth.token()).await {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("{e}");
|
log::error!("{e}");
|
||||||
HttpResponse::InternalServerError().finish()
|
HttpResponse::InternalServerError().finish()
|
||||||
}
|
}
|
||||||
Ok(res) => match res {
|
Ok(res) => match res {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use crate::{backend::Backend, Base64Encoding};
|
use crate::{backend::Backend, Base64Encoding};
|
||||||
use actix_web::{get, web, HttpResponse, Responder};
|
use actix_web::{get, web, HttpResponse, Responder};
|
||||||
use actix_web_httpauth::extractors::bearer::BearerAuth;
|
use actix_web_httpauth::extractors::bearer::BearerAuth;
|
||||||
use log::error;
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
@ -32,7 +31,7 @@ pub async fn public_key(
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("{e}");
|
log::error!("{e}");
|
||||||
HttpResponse::InternalServerError().finish()
|
HttpResponse::InternalServerError().finish()
|
||||||
}
|
}
|
||||||
Ok(res) => match res {
|
Ok(res) => match res {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
use log::info;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -15,7 +14,7 @@ impl Config {
|
||||||
pub fn from_env() -> Result<Self> {
|
pub fn from_env() -> Result<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
addr: env::var("CR_ADDRESS").unwrap_or_else(|_| {
|
addr: env::var("CR_ADDRESS").unwrap_or_else(|_| {
|
||||||
info!("Using default address 0.0.0.0");
|
log::info!("Using default address 0.0.0.0");
|
||||||
"0.0.0.0".to_string()
|
"0.0.0.0".to_string()
|
||||||
}),
|
}),
|
||||||
port: match env::var("CR_PORT") {
|
port: match env::var("CR_PORT") {
|
||||||
|
@ -23,7 +22,7 @@ impl Config {
|
||||||
Ok(port) => port,
|
Ok(port) => port,
|
||||||
Err(_) => bail!("Failed to parse environment variable CR_PORT: '{str}' is not a valid port number!"),
|
Err(_) => bail!("Failed to parse environment variable CR_PORT: '{str}' is not a valid port number!"),
|
||||||
},
|
},
|
||||||
Err(_) => { info!("Using default port 42069"); 42069 }
|
Err(_) => { log::info!("Using default port 42069"); 42069 }
|
||||||
},
|
},
|
||||||
database: match env::var("CR_DATABASE") {
|
database: match env::var("CR_DATABASE") {
|
||||||
Ok(db) => db,
|
Ok(db) => db,
|
||||||
|
|
Loading…
Reference in New Issue