From e5033534b8695fde5f6325ee9303a9d18d27390c Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Wed, 18 Jan 2023 21:05:19 +0200 Subject: [PATCH] feat: get api key from env --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 45ba3ce..f749a49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,14 +46,14 @@ struct WHSearchRes { /// get redirected to random img /// e.g. localhost:3000/random/2560x1440/16x9/100/001/+forest/APIKEY -#[get("/random/{atleast}/{ratios}/{purity}/{categories}/{q}/{api_key}")] +#[get("/random/{atleast}/{ratios}/{purity}/{categories}/{q}")] async fn random(args: web::Path) -> impl Responder { let atl = args.atleast.clone(); let rats = args.ratios.clone(); let pur = args.purity.clone(); let cats = args.categories.clone(); let q = args.q.clone(); - let api_key = args.api_key.clone(); + let api_key = env!("WH_API_KEY"); let wh_url = format!( "https://wallhaven.cc/api/v1/search?atleast={atl}&ratios={rats}&purity={pur}&categories={cats}&sorting=random&q={q}&apikey={api_key}" -- 2.44.1