Made some formatting changes.

This commit is contained in:
2025-11-08 00:04:57 -06:00
parent 49a5cd643d
commit 8b3946458e
5 changed files with 80 additions and 14 deletions

View File

@@ -1,7 +1,10 @@
// Just a way to unify error handling. Can translate eyre Reports into
// axum responses.
use axum::{http::StatusCode, response::IntoResponse};
use axum::{
http::StatusCode,
response::IntoResponse,
};
use color_eyre::eyre::Report;
use std::fmt::Display;

View File

@@ -1,23 +1,50 @@
// TODO: Add general description of the workings.
// TODO: Add ability to run a temporary pastebin
use crate::error::GBError;
use axum::{
BoxError, Router,
BoxError,
Router,
error_handling::HandleErrorLayer,
extract::{DefaultBodyLimit, Multipart, Path, State},
extract::{
DefaultBodyLimit,
Multipart,
Path,
State,
},
http::StatusCode,
response::{Html, IntoResponse, Response},
routing::{get, post},
response::{
Html,
IntoResponse,
Response,
},
routing::{
get,
post,
},
};
use clap::Parser;
use crate::error::GBError;
use nanoid::nanoid;
use std::{path::PathBuf, time::Duration};
use std::{
path::PathBuf,
time::Duration,
};
use store::Store;
use tokio::fs;
use tower::{ServiceBuilder, buffer::BufferLayer, limit::rate::RateLimitLayer};
use tower_http::{compression::CompressionLayer, limit::RequestBodyLimitLayer, trace::TraceLayer};
use tracing::{Level, event};
use tower::{
ServiceBuilder,
buffer::BufferLayer,
limit::rate::RateLimitLayer,
};
use tower_http::{
compression::CompressionLayer,
limit::RequestBodyLimitLayer,
trace::TraceLayer,
};
use tracing::{
Level,
event,
};
mod error;
mod store;
@@ -107,8 +134,11 @@ async fn paste_request(State(state): State<Store>, Path(paste_id): Path<String>)
// RUST_LOG environment variable.
fn install_tracing() {
use tracing_error::ErrorLayer;
use tracing_subscriber::prelude::*;
use tracing_subscriber::{EnvFilter, fmt};
use tracing_subscriber::{
EnvFilter,
fmt,
prelude::*,
};
let fmt_layer = fmt::layer().with_target(false);
let filter_layer = EnvFilter::try_from_default_env()

View File

@@ -1,7 +1,12 @@
use color_eyre::Result;
use rocksdb::DB;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use std::{
path::{
Path,
PathBuf,
},
sync::Arc,
};
#[derive(Clone)]
pub struct Store {