Got rid of the dotenvy_macro package and docker preparation

This commit is contained in:
Timofey Gelazoniya 2023-04-08 17:38:35 +03:00
parent 0b7549c2b6
commit e548f1b268
Signed by: zeldon
GPG Key ID: 047886915281DD2A
4 changed files with 9 additions and 21 deletions

13
Cargo.lock generated
View File

@ -169,18 +169,6 @@ version = "0.15.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" 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]] [[package]]
name = "either" name = "either"
version = "1.8.1" version = "1.8.1"
@ -438,7 +426,6 @@ dependencies = [
"anyhow", "anyhow",
"axum", "axum",
"dotenvy", "dotenvy",
"dotenvy_macro",
"env_logger", "env_logger",
"log", "log",
"magick_rust", "magick_rust",

View File

@ -3,13 +3,15 @@ edition = "2021"
name = "liquid-rescale-api" name = "liquid-rescale-api"
version = "0.1.0" 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] [dependencies]
anyhow = "1.0.70" anyhow = "1.0.70"
axum = {version = "0.6", features = ["multipart", "macros"]} axum = {version = "0.6", features = ["multipart", "macros"]}
dotenvy = "0.15.7" dotenvy = "0.15.7"
dotenvy_macro = "0.15.7"
env_logger = "0.10.0" env_logger = "0.10.0"
log = "0.4.17" log = "0.4.17"
magick_rust = "0.17.0" magick_rust = "0.17.0"

View File

@ -3,12 +3,10 @@ mod router;
mod routes; mod routes;
mod utilities; mod utilities;
use dotenvy_macro::dotenv;
use router::create_router; use router::create_router;
use std::net::SocketAddr; use std::net::SocketAddr;
pub async fn run() { pub async fn run(port: String) {
let port = dotenv!("PORT");
let app = create_router(); let app = create_router();
let address = SocketAddr::from(([0, 0, 0, 0], port.parse().unwrap())); let address = SocketAddr::from(([0, 0, 0, 0], port.parse().unwrap()));

View File

@ -5,7 +5,8 @@ use log::info;
#[tokio::main] #[tokio::main]
async fn main() { async fn main() {
dotenvy::dotenv().ok(); 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(); env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
info!("Starting app on {}", dotenvy::var("PORT").unwrap()); info!("Starting app on {}", port);
run().await; run(port).await;
} }