chore: Mostly finished s3 config

This commit is contained in:
quexeky
2026-01-20 08:31:45 +11:00
parent 6e21e40648
commit 85b2e65b5f
12 changed files with 775 additions and 820 deletions
+8 -11
View File
@@ -1,6 +1,6 @@
use crate::{
cli::{Cli, Commands},
commands::{configure::interactive_configure, upload},
commands::{configure::interactive_configure, upload}, config::Config,
};
use clap::Parser;
use fern::colors::{Color, ColoredLevelConfig};
@@ -8,15 +8,16 @@ use log::LevelFilter;
use std::env;
use std::fs;
use std::io;
mod cli;
mod commands;
mod config;
mod manifest;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
configure_logging()?;
let cli = Cli::parse();
let config = Config::new();
match &cli.command {
Commands::Configure { url, token } => {
if let Some(token) = token {
@@ -25,7 +26,7 @@ async fn main() -> anyhow::Result<()> {
}
}
Commands::Upload(info) => {
upload::interface::upload(info).await?;
upload::interface::upload(info, config).await?;
}
};
@@ -34,7 +35,6 @@ async fn main() -> anyhow::Result<()> {
pub fn configure_logging() -> anyhow::Result<()> {
let log_level = env::var("RUST_LOG")
.or_else(|_| env::var("LOG_LEVEL"))
.unwrap_or_else(|_| "info".to_string())
.parse::<LevelFilter>()?;
@@ -45,27 +45,24 @@ pub fn configure_logging() -> anyhow::Result<()> {
let colors = ColoredLevelConfig::new()
.error(Color::Red)
.warn(Color::Yellow)
.info(Color::Green)
.debug(Color::Blue)
.info(Color::Blue)
.debug(Color::Green)
.trace(Color::Magenta);
fern::Dispatch::new()
.chain(
// Console output with colors and formatting
fern::Dispatch::new()
.format(move |out, message, record| {
out.finish(format_args!(
"[{}] {} {} - {}",
chrono::Local::now().format("%Y-%m-%d %H:%M:%S%.3f"),
"[{}] {}: {}",
chrono::Local::now().format("%H:%M:%S%.3f"),
colors.color(record.level()),
record.target(),
message
))
})
.chain(io::stdout()),
)
.chain(
// File output without colors and with formatting
fern::Dispatch::new()
.format(|out, message, record| {
out.finish(format_args!(