diff options
author | Vika <vika@fireburn.ru> | 2022-08-13 22:33:38 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-08-13 22:36:13 +0300 |
commit | 629531bdefad41e8839fa818e68bcf9a083466f8 (patch) | |
tree | 65c9bb8a5e51bcbadeded91e15b694482c075c21 /kittybox-rs/src | |
parent | 8a6447c8aabb36ec4a8e66c61c058fbf36727802 (diff) | |
download | kittybox-629531bdefad41e8839fa818e68bcf9a083466f8.tar.zst |
NixOS module fixes and temporary fixes to the legacy configuration
Diffstat (limited to 'kittybox-rs/src')
-rw-r--r-- | kittybox-rs/src/main.rs | 43 |
1 files changed, 7 insertions, 36 deletions
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()) |