-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update axum to 0.7 #514
Labels
Comments
Yep, I've got a fork with the update, so I will post it and we'll see when the maintainer can get it merged. Also for the state, you can simply add it to a struct #[derive(Clone)]
pub struct SharedApp(Arc<App>);
impl Deref for SharedApp {
type Target = Arc<App>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
pub struct App {
pub is: IntrospectionState,
// Add your own state here
}
impl App {
pub fn to_shared(self) -> SharedApp {
SharedApp(Arc::new(self))
}
}
impl FromRef<SharedApp> for IntrospectionState {
fn from_ref(input: &SharedApp) -> Self {
input.is.clone()
}
}
// ... Se example
let is = IntrospectionStateBuilder::new("https://zitadel-libraries-l8boqa.zitadel.cloud")
.with_basic_auth(
// ... skipped for brevity
)
.build()
.await
.unwrap();
let state = App {
is
// ... Add your other state
}.to_shared()
let app = Router::new()
.route("/unauthed", get(unauthed))
.route("/authed", get(authed))
.with_state(state); Something along those lines. Btw this is the recommended pattern from upstream as well |
Closed
buehler
added a commit
that referenced
this issue
Jan 23, 2024
🎉 This issue has been resolved in version 3.5.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thank you for creating this crate!
Would it be possbile to update axum to 0.7?
I also wondered how one could pass other states to axum through
app.with_state()
like a mongodb client while using the User extractor.The text was updated successfully, but these errors were encountered: