Skip to content

Commit

Permalink
chore(volo-grpc): make grpc-web as a feature (#479)
Browse files Browse the repository at this point in the history
* chore(volo-grpc): make grpc-web as a feature

* fix cargo clippy
  • Loading branch information
Millione authored Aug 1, 2024
1 parent eb90e1f commit 0536f8b
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 49 deletions.
108 changes: 69 additions & 39 deletions 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 examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ tracing-subscriber.workspace = true

pilota.workspace = true
volo = { path = "../volo" }
volo-grpc = { path = "../volo-grpc" }
volo-grpc = { path = "../volo-grpc", features = ["grpc-web"] }
volo-thrift = { path = "../volo-thrift", features = ["multiplex"] }
volo-http = { path = "../volo-http", features = [
"default_client",
Expand Down
2 changes: 0 additions & 2 deletions examples/src/thrift/hello/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ lazy_static! {
};
}

pub struct LogService<S>(S);

#[volo::main]
async fn main() {
let req = volo_gen::thrift_gen::hello::HelloRequest {
Expand Down
2 changes: 0 additions & 2 deletions examples/src/thrift/multiplex/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ lazy_static! {
};
}

pub struct LogService<S>(S);

#[volo::main]
async fn main() {
let subscriber = tracing_subscriber::FmtSubscriber::builder()
Expand Down
2 changes: 0 additions & 2 deletions examples/src/thrift/unknown/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ lazy_static! {
};
}

pub struct LogService<S>(S);

#[volo::main]
async fn main() {
tracing_subscriber::fmt::init();
Expand Down
1 change: 1 addition & 0 deletions scripts/clippy-and-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ echo_command cargo clippy -p volo-grpc --no-default-features -- --deny warnings
echo_command cargo clippy -p volo-grpc --no-default-features --features rustls -- --deny warnings
echo_command cargo clippy -p volo-grpc --no-default-features --features native-tls -- --deny warnings
echo_command cargo clippy -p volo-grpc --no-default-features --features native-tls-vendored -- --deny warnings
echo_command cargo clippy -p volo-grpc --no-default-features --features grpc-web -- --deny warnings
echo_command cargo clippy -p volo-http --no-default-features -- --deny warnings
echo_command cargo clippy -p volo-http --no-default-features --features default_client -- --deny warnings
echo_command cargo clippy -p volo-http --no-default-features --features default_server -- --deny warnings
Expand Down
8 changes: 5 additions & 3 deletions volo-grpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "volo-grpc"
version = "0.10.2"
version = "0.10.3"
edition.workspace = true
homepage.workspace = true
repository.workspace = true
Expand Down Expand Up @@ -55,8 +55,8 @@ pin-project.workspace = true
tokio = { workspace = true, features = ["time", "rt", "net", "sync", "signal"] }
tokio-stream.workspace = true
tokio-util = { workspace = true, features = ["codec", "compat"] }
tonic.workspace = true
tonic-web.workspace = true
tonic = { workspace = true, optional = true }
tonic-web = { workspace = true, optional = true }
tower = { workspace = true, features = [
"buffer",
"limit",
Expand All @@ -80,3 +80,5 @@ __tls = []
rustls = ["__tls", "dep:tokio-rustls", "volo/rustls"]
native-tls = ["__tls", "dep:tokio-native-tls", "volo/native-tls"]
native-tls-vendored = ["native-tls", "volo/native-tls-vendored"]

grpc-web = ["dep:tonic", "dep:tonic-web"]
1 change: 1 addition & 0 deletions volo-grpc/src/layer/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod cross_origin;
pub mod grpc_timeout;
#[cfg(feature = "grpc-web")]
pub mod grpc_web;
pub mod loadbalance;
pub mod user_agent;

0 comments on commit 0536f8b

Please sign in to comment.