DEVELOPMENT ENVIRONMENT

~liljamo/wallhavenapirandom

e5033534b8695fde5f6325ee9303a9d18d27390c — Jonni Liljamo 1 year, 10 months ago eb80c06
feat: get api key from env
1 files changed, 2 insertions(+), 2 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +2 -2
@@ 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<RandomArgs>) -> 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}"