Skip to content

Commit 069672f

Browse files
authored
chore: Adjust docs (#8)
* adjust `README` Add CI badge, adjust example, add 'compatibility' section. * envoy-types: adjust `lib.rs` doc Changes in line with `README` adjustments.
1 parent 465af6a commit 069672f

File tree

2 files changed

+36
-17
lines changed

2 files changed

+36
-17
lines changed

README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ through Rust gRPC services.
66
Among other use cases, this crate can be used to implement an
77
[Envoy External Authorization] (ExtAuthz) gRPC Server written in Rust.
88

9-
[![Crates.io](https://img.shields.io/crates/v/envoy-types)](https://crates.io/crates/envoy-types)
10-
[![Documentation](https://docs.rs/envoy-types/badge.svg)](https://docs.rs/envoy-types)
11-
[![Crates.io](https://img.shields.io/crates/l/envoy-types)](LICENSE)
9+
[![Crates.io Badge](https://img.shields.io/crates/v/envoy-types)](https://crates.io/crates/envoy-types)
10+
[![Documentation Badge](https://docs.rs/envoy-types/badge.svg)](https://docs.rs/envoy-types)
11+
[![License Badge](https://img.shields.io/crates/l/envoy-types)](LICENSE)
12+
![CI Badge](https://github.com/flemosr/envoy-types/actions/workflows/ci.yml/badge.svg)
1213

1314
[Examples] | [Docs]
1415

@@ -37,6 +38,7 @@ including query parameters and header manipulation, can be found at the
3738
[examples] directory.
3839

3940
```rust
41+
use std::env;
4042
use tonic::{transport::Server, Request, Response, Status};
4143

4244
use envoy_types::ext_authz::v3::pb::{
@@ -73,8 +75,9 @@ impl Authorization for MyServer {
7375

7476
#[tokio::main]
7577
async fn main() -> Result<(), Box<dyn std::error::Error>> {
76-
let addr = format!("0.0.0.0:50051").parse().unwrap();
77-
let server = MyServer::default();
78+
let server_port = env::var("SERVER_PORT").unwrap_or("50051".into());
79+
let addr = format!("0.0.0.0:{server_port}").parse().unwrap();
80+
let server = MyServer;
7881

7982
println!("AuthorizationServer listening on {addr}");
8083

@@ -87,9 +90,17 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
8790
}
8891
```
8992

90-
You can check the currently supported version of [`tonic`] at this crate's
91-
[`Cargo.toml`] file. If you want to work with a previous version, consider
92-
using a [previous version of `envoy-types`].
93+
## Compatibility
94+
95+
The table bellow outlines the correspondence between the versions of [`tonic`]
96+
and the compatible versions of [`envoy-types`].
97+
98+
`tonic` | `envoy-types`
99+
:- | :-
100+
v0.12 | [v0.5](https://crates.io/crates/envoy-types/0.5.3)
101+
v0.11 | [v0.4](https://crates.io/crates/envoy-types/0.4.0)
102+
v0.10 | [v0.3](https://crates.io/crates/envoy-types/0.3.0)
103+
v0.9 | [v0.2](https://crates.io/crates/envoy-types/0.2.0)
93104

94105
## License
95106

@@ -104,8 +115,7 @@ terms or conditions.
104115
[Envoy Proxy]: https://www.envoyproxy.io
105116
[Envoy External Authorization]: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/ext_authz_filter
106117
[examples]: https://github.com/flemosr/envoy-types/tree/main/examples
107-
[`Cargo.toml`]: https://github.com/flemosr/envoy-types/blob/main/envoy-types/Cargo.toml
108-
[previous version of `envoy-types`]: https://crates.io/crates/envoy-types/versions
118+
[`envoy-types`]: https://crates.io/crates/envoy-types
109119
[Docs]: https://docs.rs/envoy-types/latest/envoy_types
110120
[protoc-install]: https://grpc.io/docs/protoc-installation/
111121
[`tonic`]: https://github.com/hyperium/tonic

envoy-types/src/lib.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ query parameters and header manipulation, can be found at the [examples]
3030
directory.
3131
3232
```rust
33+
use std::env;
3334
use tonic::{transport::Server, Request, Response, Status};
3435
3536
use envoy_types::ext_authz::v3::pb::{
@@ -66,8 +67,9 @@ impl Authorization for MyServer {
6667
6768
// #[tokio::main]
6869
// async fn main() -> Result<(), Box<dyn std::error::Error>> {
69-
// let addr = format!("0.0.0.0:50051").parse().unwrap();
70-
// let server = MyServer::default();
70+
// let server_port = env::var("SERVER_PORT").unwrap_or("50051".into());
71+
// let addr = format!("0.0.0.0:{server_port}").parse().unwrap();
72+
// let server = MyServer;
7173
7274
// println!("AuthorizationServer listening on {addr}");
7375
@@ -80,17 +82,24 @@ impl Authorization for MyServer {
8082
// }
8183
```
8284
83-
You can check the currently supported version of [`tonic`] at this crate's
84-
[`Cargo.toml`] file. If you want to work with a previous version, consider
85-
using a [previous version of `envoy-types`].
85+
# Compatibility
86+
87+
The table bellow outlines the correspondence between the versions of [`tonic`]
88+
and the compatible versions of [`envoy-types`].
89+
90+
`tonic` | `envoy-types`
91+
:- | :-
92+
v0.12 | [v0.5](https://crates.io/crates/envoy-types/0.5.3)
93+
v0.11 | [v0.4](https://crates.io/crates/envoy-types/0.4.0)
94+
v0.10 | [v0.3](https://crates.io/crates/envoy-types/0.3.0)
95+
v0.9 | [v0.2](https://crates.io/crates/envoy-types/0.2.0)
8696
8797
[Envoy Proxy]: https://www.envoyproxy.io
8898
[Envoy External Authorization]: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/ext_authz_filter
8999
[protoc-install]: https://grpc.io/docs/protoc-installation/
90100
[`tonic`]: https://github.com/hyperium/tonic
91101
[examples]: https://github.com/flemosr/envoy-types/tree/main/examples
92-
[`Cargo.toml`]: https://github.com/flemosr/envoy-types/blob/main/envoy-types/Cargo.toml
93-
[previous version of `envoy-types`]: https://crates.io/crates/envoy-types/versions
102+
[`envoy-types`]: https://crates.io/crates/envoy-types
94103
*/
95104

96105
#![warn(missing_debug_implementations, rust_2018_idioms)]

0 commit comments

Comments
 (0)