refactor(deps): removed clap

This commit is contained in:
antifallobst 2023-09-09 16:05:22 +02:00
parent 452d2d2015
commit 3f59c1981f
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
4 changed files with 3 additions and 125 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
# IDE directories # IDE directories
.fleet .fleet
.idea
.vscode
# Rust stuff # Rust stuff
target target

109
Cargo.lock generated
View File

@ -292,55 +292,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "anstream"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is-terminal",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd"
[[package]]
name = "anstyle-parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.72" version = "1.0.72"
@ -609,53 +560,6 @@ dependencies = [
"libloading", "libloading",
] ]
[[package]]
name = "clap"
version = "4.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd"
dependencies = [
"clap_builder",
"clap_derive",
"once_cell",
]
[[package]]
name = "clap_builder"
version = "4.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa"
dependencies = [
"anstream",
"anstyle",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_derive"
version = "4.3.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn 2.0.28",
]
[[package]]
name = "clap_lex"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]] [[package]]
name = "const-oid" name = "const-oid"
version = "0.9.5" version = "0.9.5"
@ -1627,7 +1531,6 @@ dependencies = [
"argon2", "argon2",
"base64 0.21.3", "base64 0.21.3",
"chrono", "chrono",
"clap",
"env_logger", "env_logger",
"libinjection", "libinjection",
"log", "log",
@ -2529,12 +2432,6 @@ dependencies = [
"unicode-normalization", "unicode-normalization",
] ]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "subtle" name = "subtle"
version = "2.5.0" version = "2.5.0"
@ -2877,12 +2774,6 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "utf8parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.4.1" version = "1.4.1"

View File

@ -14,7 +14,6 @@ libinjection = "0.3.2"
sha2 = "0.10.2" sha2 = "0.10.2"
env_logger = "0.10" env_logger = "0.10"
log = "0.4" log = "0.4"
clap = { version = "4.3.21", features = ["derive"] }
actix-web-httpauth = "0.8.0" actix-web-httpauth = "0.8.0"
sqlx = { version = "0.7.1", features = ["runtime-tokio", "postgres", "chrono"] } sqlx = { version = "0.7.1", features = ["runtime-tokio", "postgres", "chrono"] }
uuid = { version = "1.4.1", features = ["v4"] } uuid = { version = "1.4.1", features = ["v4"] }

View File

@ -5,30 +5,16 @@ mod security;
mod tokens; mod tokens;
use anyhow::Result; use anyhow::Result;
use clap::Parser;
use log::info; use log::info;
use sqlx::postgres::PgPool; use sqlx::postgres::PgPool;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// Sets the port on which the API listens
#[arg(short, long)]
port: Option<u16>,
}
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();
info!("Starting NerdcultAPI v0.1"); info!("Starting NerdcultAPI v0.1");
let args = Args::parse(); let port: u16 = 8080;
let mut port: u16 = 8080;
if let Some(p) = args.port {
port = p;
}
let pool = PgPool::connect(&std::env::var("DATABASE_URL").map_err(|_| { let pool = PgPool::connect(&std::env::var("DATABASE_URL").map_err(|_| {
anyhow::Error::msg("Environment variable DATABASE_URL needs to be specified!") anyhow::Error::msg("Environment variable DATABASE_URL needs to be specified!")