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"
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",

View File

@ -3,13 +3,15 @@ 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"

View File

@ -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()));

View File

@ -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;
}