Skip to content

Commit

Permalink
wrap AppData in Data.
Browse files Browse the repository at this point in the history
This seems like a weird gotcha in ActixWeb v4.

Why not only accept a Data instead of letting this fail at runtime!?
  • Loading branch information
NfNitLoop committed Sep 26, 2022
1 parent f02e98d commit 433d28b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "feoblog"
version = "0.7.0-rc3"
version = "0.7.0-rc5"
authors = ["Cody Casterline <cody.casterline@gmail.com>"]
edition = "2018"

Expand Down
9 changes: 6 additions & 3 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ pub(crate) fn serve(command: ServeCommand) -> Result<(), anyhow::Error> {
};

let app_factory = move || {
let data = Data::new(
AppData{
backend_factory: factory_box.factory.dyn_clone(),
}
);
let mut app = App::new()
.wrap(actix_web::middleware::Logger::default())
.app_data(AppData{
backend_factory: factory_box.factory.dyn_clone(),
})
.app_data(data)
.configure(routes)
;

Expand Down

0 comments on commit 433d28b

Please sign in to comment.