Skip to content
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

chore: up deps #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ edition = "2021"
[dependencies]
hyper = {version = "0.14.28",features = ["full"]}
tokio = {version = "1.35.1",features = ["full"]}
tonic = "0.10.2"
tonic-reflection = "0.10.2"
tonic = "0.11.0"
tonic-reflection = "0.11.0"
prost = "0.12.3"
prost-types = "0.12.3"
tower = "0.4.13"
hyper-util = {version = "0.1.3",features = ["tokio"]}
http-body-util = "0.1.0"
anyhow = "1.0.79"
tokio-stream = "0.1.14"

[build-dependencies]
tonic-build = "0.10.2"
7 changes: 5 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ use std::path::PathBuf;
fn main() {
let mut news = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
news.push("news.proto");
tonic_build::compile_protos(news.clone()).expect("Failed to compile protos");
news.pop();
news.push("reflection.proto");
tonic_build::compile_protos(news).expect("Failed to compile protos");

let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
/* let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());

tonic_build::configure()
.file_descriptor_set_path(out_dir.join("news_descriptor.bin"))
.compile(&["news.proto"], &["proto"])
.unwrap();
.unwrap();*/
}
4 changes: 1 addition & 3 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
"extends": ["config:recommended"]
}
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
mod server;

use tonic::{transport::Server as TonicServer, Response, Status};

use crate::news::news_service_server::NewsServiceServer;
use crate::server::Builder;
use anyhow::Result;
use news::news_service_server::NewsService;
use news::{MultipleNewsId, News, NewsId, NewsList};
Expand All @@ -9,6 +12,7 @@ use tower::make::Shared;

pub mod news {
tonic::include_proto!("news"); // The package name specified in your .proto
// tonic::include_proto!("grpc.reflection.v1alpha"); // The package name specified in your .proto
pub(crate) const FILE_DESCRIPTOR_SET: &[u8] =
tonic::include_file_descriptor_set!("news_descriptor");
}
Expand Down Expand Up @@ -152,10 +156,10 @@ async fn main() -> Result<()> {
let addr = ([127, 0, 0, 1], 50051).into();

let news_service = MyNewsService::new();
let service = tonic_reflection::server::Builder::configure()

let service = Builder::configure()
.register_encoded_file_descriptor_set(news::FILE_DESCRIPTOR_SET)
.build()
.unwrap();
.build()?;

println!("NewsService server listening on {}", addr);

Expand Down
Loading