mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-24 00:00:16 +02:00
Remove once_cell from jwt example (#3014)
Signed-off-by: Hayashi Mikihiro <[email protected]>
This commit is contained in:
@@ -18,10 +18,10 @@ use axum_extra::{
|
||||
TypedHeader,
|
||||
};
|
||||
use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, Validation};
|
||||
use once_cell::sync::Lazy;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::json;
|
||||
use std::fmt::Display;
|
||||
use std::sync::LazyLock;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
// Quick instructions
|
||||
@@ -50,7 +50,7 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
// -H 'Authorization: Bearer blahblahblah' \
|
||||
// http://localhost:3000/protected
|
||||
|
||||
static KEYS: Lazy<Keys> = Lazy::new(|| {
|
||||
static KEYS: LazyLock<Keys> = LazyLock::new(|| {
|
||||
let secret = std::env::var("JWT_SECRET").expect("JWT_SECRET must be set");
|
||||
Keys::new(secret.as_bytes())
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user