Skip to content

Commit

Permalink
add the api token to the local script
Browse files Browse the repository at this point in the history
  • Loading branch information
Austionian committed Oct 17, 2023
1 parent acb92cd commit 1b4cb90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions scripts/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &'

Expand Down
3 changes: 2 additions & 1 deletion src/routes/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ pub async fn get_blog_post(headers: HeaderMap, Path(post_name): Path<String>) ->
}
};

// 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();
Expand Down

0 comments on commit 1b4cb90

Please sign in to comment.