diff --git a/.gitignore b/.gitignore index 53c8640..932ed18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # IDE directories .fleet +.idea +.vscode # Rust stuff target diff --git a/Cargo.lock b/Cargo.lock index 8a28bff..be7eefa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -292,55 +292,6 @@ dependencies = [ "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]] name = "anyhow" version = "1.0.72" @@ -609,53 +560,6 @@ dependencies = [ "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]] name = "const-oid" version = "0.9.5" @@ -1627,7 +1531,6 @@ dependencies = [ "argon2", "base64 0.21.3", "chrono", - "clap", "env_logger", "libinjection", "log", @@ -2529,12 +2432,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "subtle" version = "2.5.0" @@ -2877,12 +2774,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - [[package]] name = "uuid" version = "1.4.1" diff --git a/Cargo.toml b/Cargo.toml index df4e056..a91feec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ libinjection = "0.3.2" sha2 = "0.10.2" env_logger = "0.10" log = "0.4" -clap = { version = "4.3.21", features = ["derive"] } actix-web-httpauth = "0.8.0" sqlx = { version = "0.7.1", features = ["runtime-tokio", "postgres", "chrono"] } uuid = { version = "1.4.1", features = ["v4"] } diff --git a/src/main.rs b/src/main.rs index ba300ea..d338d90 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,30 +5,16 @@ mod security; mod tokens; use anyhow::Result; -use clap::Parser; use log::info; 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, -} - #[tokio::main] async fn main() -> Result<()> { env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); info!("Starting NerdcultAPI v0.1"); - let args = Args::parse(); - - let mut port: u16 = 8080; - if let Some(p) = args.port { - port = p; - } + let port: u16 = 8080; let pool = PgPool::connect(&std::env::var("DATABASE_URL").map_err(|_| { anyhow::Error::msg("Environment variable DATABASE_URL needs to be specified!")