1
0
Fork 0
mirror of https://codeberg.org/Mo8it/git-webhook-client synced 2024-10-18 07:22:39 +00:00

Refactor imports

This commit is contained in:
Mo 2022-12-16 18:27:58 +01:00
parent 05bd6576a9
commit 89789c196b
6 changed files with 32 additions and 25 deletions

View file

@ -1,8 +1,6 @@
use anyhow::{Context, Result};
use serde::Deserialize;
use std::env;
use std::fs::File;
use std::io::BufReader;
use std::{env, fs::File, io::BufReader};
#[derive(Deserialize)]
pub struct SocketAddress {

View file

@ -7,9 +7,11 @@ use diesel::{
use std::env;
use tracing::error;
use crate::config::Hook;
use crate::models::{HookLog, NewHookLog};
use crate::schema::hooklog;
use crate::{
config::Hook,
models::{HookLog, NewHookLog},
schema::hooklog,
};
type DBConnectionManager = ConnectionManager<SqliteConnection>;
pub type DBPool = Pool<DBConnectionManager>;

View file

@ -1,5 +1,7 @@
use axum::http::StatusCode;
use axum::response::{IntoResponse, Response};
use axum::{
http::StatusCode,
response::{IntoResponse, Response},
};
use tracing::error;
pub struct AppError(anyhow::Error);

View file

@ -1,9 +1,10 @@
use anyhow::{Context, Result};
use lettre::address::Address;
use lettre::message::{Mailbox, MessageBuilder};
use lettre::transport::smtp::authentication::Credentials;
use lettre::Transport;
use lettre::{Message, SmtpTransport};
use lettre::{
address::Address,
message::{Mailbox, Message, MessageBuilder},
transport::{smtp::authentication::Credentials, Transport},
SmtpTransport,
};
use std::mem;
use crate::config;

View file

@ -10,11 +10,15 @@ mod states;
mod templates;
use anyhow::Result;
use axum::routing::{get, post};
use axum::{Router, Server};
use axum::{
routing::{get, post},
Router, Server,
};
use axum_extra::routing::SpaRouter;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::process;
use std::{
net::{IpAddr, Ipv4Addr, SocketAddr},
process,
};
use tracing::info;
async fn init() -> Result<()> {
@ -54,8 +58,8 @@ async fn init() -> Result<()> {
#[tokio::main]
async fn main() {
init().await.unwrap_or_else(|e| {
if let Err(e) = init().await {
eprintln!("{e:?}");
process::exit(1);
});
};
}

View file

@ -1,16 +1,16 @@
use anyhow::Context;
use askama_axum::IntoResponse;
use axum::extract::{Query, State};
use axum::http::header::HeaderMap;
use axum::response::Response;
use axum::{
extract::{Query, State},
http::header::HeaderMap,
response::Response,
};
use bytes::Bytes;
use hmac::{Hmac, Mac};
use serde::Deserialize;
use serde_json::Value;
use sha2::Sha256;
use std::process::Command;
use std::sync::Arc;
use std::thread;
use std::{process::Command, sync::Arc, thread};
use tracing::{error, info};
use crate::{db, errors, mailer, states, templates};