Skip to content

Commit

Permalink
Merge pull request #26 from second-state/chore/update_dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
juntao authored Apr 29, 2024
2 parents 65b18e2 + c22bfe3 commit 2289c95
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build]
target = "wasm32-wasi"
rustflags = ["--cfg", "wasmedge", "--cfg", "tokio_unstable"]
13 changes: 10 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ name = "order_demo_service"
version = "0.1.0"
edition = "2021"

[patch.crates-io]
tokio = { git = "https://github.com/second-state/wasi_tokio.git", branch = "v1.36.x" }
socket2 = { git = "https://github.com/second-state/socket2.git", branch = "v0.5.x" }
hyper = { git = "https://github.com/second-state/wasi_hyper.git", branch = "v0.14.x" }

[dependencies]
anyhow = "1.0"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
url = "2.3"
mysql_async_wasi = "=0.31.5"
hyper_wasi = { version = "0.15", features = ["full"] }
tokio_wasi = { version = "1", features = ["io-util", "fs", "net", "time", "rt", "macros"] }

mysql_async = { version = "0.34", default-features=false, features = [ "default-rustls" ], git="https://github.com/blackbeam/mysql_async.git" }
zstd-sys = "=2.0.9"
hyper = { version = "0.14", features = ["full"] }
tokio = { version = "1", features = ["io-util", "fs", "net", "time", "rt", "macros"] }
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let pool = Pool::new(builder.pool_opts(pool_opts));

let addr = SocketAddr::from(([0, 0, 0, 0], 8080));
let tcp_listener = tokio::net::TcpListener::bind(addr).await.unwrap();
let make_svc = make_service_fn(|_| {
let pool = pool.clone();
async move {
Expand All @@ -234,7 +235,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
}))
}
});
let server = Server::bind(&addr).serve(make_svc);
let server = Server::from_tcp(tcp_listener.into_std().unwrap()).unwrap().serve(make_svc);
if let Err(e) = server.await {
eprintln!("server error: {}", e);
}
Expand Down

0 comments on commit 2289c95

Please sign in to comment.