From 696ae495aca701c3431710e5dfc03e15aba2f74e Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 17 May 2021 04:12:48 +0300 Subject: Refactoring, easter egg, healthcheck endpoint, support for rel= indieweb APIs and preparation for onboarding --- src/main.rs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 778aa4a..ce654df 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,9 +39,27 @@ async fn main() -> Result<(), std::io::Error> { 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) => authorization_endpoint = 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 media_endpoint: Option = env::var("MEDIA_ENDPOINT").ok(); let host = env::var("SERVE_AT").ok().unwrap_or_else(|| "0.0.0.0:8080".to_string()); - let app = micropub::get_app_with_redis(token_endpoint, redis_uri, media_endpoint).await; + let app = micropub::get_app_with_redis(token_endpoint, authorization_endpoint, redis_uri, media_endpoint).await; app.listen(host).await -} \ No newline at end of file +} -- cgit 1.4.1