From 1b4cb9054e67ae4eba8706eefe7816495ff47f63 Mon Sep 17 00:00:00 2001 From: Austin Rooks Date: Mon, 16 Oct 2023 21:35:15 -0500 Subject: [PATCH] add the api token to the local script --- scripts/dev.sh | 2 ++ src/routes/post.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/dev.sh b/scripts/dev.sh index c12dbe4..161b99a 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -9,6 +9,8 @@ minify() { echo "Starting the Axum server." +export API_TOKEN=$(cat ".env") + # Start cargo watch in the background sh -c 'cargo watch -x run &' diff --git a/src/routes/post.rs b/src/routes/post.rs index 932634a..c9a8d8b 100644 --- a/src/routes/post.rs +++ b/src/routes/post.rs @@ -39,7 +39,8 @@ pub async fn get_blog_post(headers: HeaderMap, Path(post_name): Path) -> } }; - // Update the read count of the post in a different thread. + // Update the read count of the post in a different thread so the response + // from the worker isn't blocking request to get the post. tokio::spawn(async move { let api_token = std::env::var("API_TOKEN").unwrap(); let client = Client::new();