1
0
Fork 0
mirror of https://codeberg.org/Mo8it/git-webhook-client synced 2024-11-23 11:11:36 +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 anyhow::{Context, Result};
use serde::Deserialize; use serde::Deserialize;
use std::env; use std::{env, fs::File, io::BufReader};
use std::fs::File;
use std::io::BufReader;
#[derive(Deserialize)] #[derive(Deserialize)]
pub struct SocketAddress { pub struct SocketAddress {

View file

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

View file

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

View file

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

View file

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

View file

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