From 629531bdefad41e8839fa818e68bcf9a083466f8 Mon Sep 17 00:00:00 2001 From: Vika Date: Sat, 13 Aug 2022 22:33:38 +0300 Subject: NixOS module fixes and temporary fixes to the legacy configuration --- kittybox-rs/src/main.rs | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) (limited to 'kittybox-rs/src/main.rs') diff --git a/kittybox-rs/src/main.rs b/kittybox-rs/src/main.rs index 7a363b8..fcfc135 100644 --- a/kittybox-rs/src/main.rs +++ b/kittybox-rs/src/main.rs @@ -1,7 +1,6 @@ use kittybox::database::FileStorage; use std::{env, time::Duration}; use tracing::{debug, error, info}; -use url::Url; #[tokio::main] async fn main() { @@ -24,40 +23,6 @@ async fn main() { } }; - let token_endpoint: Url = match env::var("TOKEN_ENDPOINT") { - Ok(val) => { - debug!("Token endpoint: {}", val); - match Url::parse(&val) { - Ok(val) => val, - _ => { - error!("Token endpoint URL cannot be parsed, aborting."); - std::process::exit(1) - } - } - } - Err(_) => { - error!("TOKEN_ENDPOINT is not set, will not be able to authorize users!"); - std::process::exit(1) - } - }; - - let authorization_endpoint: Url = match env::var("AUTHORIZATION_ENDPOINT") { - Ok(val) => { - debug!("Auth endpoint: {}", val); - match Url::parse(&val) { - Ok(val) => val, - _ => { - error!("Authorization endpoint URL cannot be parsed, aborting."); - std::process::exit(1) - } - } - } - Err(_) => { - error!("AUTHORIZATION_ENDPOINT is not set, will not be able to confirm token and ID requests using IndieAuth!"); - std::process::exit(1) - } - }; - let listen_at = match env::var("SERVE_AT") .ok() .unwrap_or_else(|| "[::]:8080".to_string()) @@ -190,7 +155,13 @@ async fn main() { .merge(media) //.merge(indieauth) .merge(technical) - .layer(axum::Extension(kittybox::tokenauth::TokenEndpoint(token_endpoint))) + .layer( + axum::Extension( + kittybox::tokenauth::TokenEndpoint( + "https://tokens.indieauth.com/token".parse().unwrap() + ) + ) + ) .layer(tower::ServiceBuilder::new() .layer(tower_http::trace::TraceLayer::new_for_http()) .into_inner()) -- cgit 1.4.1