diff --git a/Cargo.lock b/Cargo.lock index 4c4a9f2..55dd189 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -169,18 +169,6 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" -[[package]] -name = "dotenvy_macro" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0235d912a8c749f4e0c9f18ca253b4c28cfefc1d2518096016d6e3230b6424" -dependencies = [ - "dotenvy", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "either" version = "1.8.1" @@ -438,7 +426,6 @@ dependencies = [ "anyhow", "axum", "dotenvy", - "dotenvy_macro", "env_logger", "log", "magick_rust", diff --git a/Cargo.toml b/Cargo.toml index bac1b71..510de11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,16 +3,18 @@ edition = "2021" name = "liquid-rescale-api" version = "0.1.0" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +# This seems redundant, but it's necessary for Docker to work +[[bin]] +name = "liquid-rescale-api" +path = "src/main.rs" [dependencies] anyhow = "1.0.70" axum = {version = "0.6", features = ["multipart", "macros"]} dotenvy = "0.15.7" -dotenvy_macro = "0.15.7" env_logger = "0.10.0" log = "0.4.17" magick_rust = "0.17.0" -serde = { version = "1.0.159", features = ["derive"] } +serde = {version = "1.0.159", features = ["derive"]} serde_json = "1.0.95" tokio = {version = "1", features = ["macros", "rt-multi-thread"]} diff --git a/src/lib.rs b/src/lib.rs index 94347ae..26ef1eb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,12 +3,10 @@ mod router; mod routes; mod utilities; -use dotenvy_macro::dotenv; use router::create_router; use std::net::SocketAddr; -pub async fn run() { - let port = dotenv!("PORT"); +pub async fn run(port: String) { let app = create_router(); let address = SocketAddr::from(([0, 0, 0, 0], port.parse().unwrap())); diff --git a/src/main.rs b/src/main.rs index fa91e62..cdb58bf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,8 @@ use log::info; #[tokio::main] async fn main() { dotenvy::dotenv().ok(); + let port = dotenvy::var("PORT").unwrap_or("3000".to_string()); env_logger::Builder::from_env(Env::default().default_filter_or("info")).init(); - info!("Starting app on {}", dotenvy::var("PORT").unwrap()); - run().await; + info!("Starting app on {}", port); + run(port).await; }