Skip to content

Commit e4b1570

Browse files
authored
feat: Add deprecated warning when running HTTP server (#943)
* chore: Mark HTTP server as deprecated * feat: Add deprecated warning when running HTTP server * 0.8.24 * Set deprecated as allowed
1 parent 276f656 commit e4b1570

File tree

9 files changed

+43
-13
lines changed

9 files changed

+43
-13
lines changed

.github/workflows/pr.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ jobs:
7474
uses: actions-rs/cargo@v1
7575
with:
7676
command: clippy
77-
args: -- -D warnings
77+
args: -- -D warnings -A deprecated

Cargo.lock

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "check-if-email-exists-cli"
3-
version = "0.8.23"
3+
version = "0.8.24"
44
default-run = "check_if_email_exists"
55
edition = "2018"
66
description = "Check if an email address exists without sending any email."

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ FROM alpine
88
# `ciee` stands for check-if-email-exists
99
WORKDIR /ciee
1010
# Fetch latest version
11-
ENV CIEE_VERSION 0.8.23
11+
ENV CIEE_VERSION 0.8.24
1212

1313
# Install needed libraries
1414
RUN apk update && \

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Head to the [releases page](https://github.com/reacherhq/check-if-email-exists/r
110110

111111
```
112112
> $ check_if_email_exists --help
113-
check_if_email_exists 0.8.23
113+
check_if_email_exists 0.8.24
114114
Check if an email address exists without sending any email.
115115
116116
USAGE:

core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "check-if-email-exists"
3-
version = "0.8.23"
3+
version = "0.8.24"
44
authors = ["Amaury <[email protected]>"]
55
categories = ["email"]
66
description = "Check if an email address exists without sending any email"

src/http.rs

+15
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ use crate::CONF;
2525

2626
/// JSON Request from POST /
2727
#[derive(Debug, Deserialize, Serialize)]
28+
#[deprecated(
29+
since = "0.8.24",
30+
note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
31+
)]
2832
pub struct PostReqBody {
2933
from_email: Option<String>,
3034
hello_name: Option<String>,
@@ -35,9 +39,14 @@ pub struct PostReqBody {
3539

3640
/// Error Response from POST /
3741
#[derive(Debug, Deserialize, Serialize)]
42+
#[deprecated(
43+
since = "0.8.24",
44+
note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
45+
)]
3846
pub struct PostResError {
3947
error: String,
4048
}
49+
4150
async fn req_handler(req: Request<Body>) -> Result<Response<Body>, hyper::Error> {
4251
match (req.method(), req.uri().path()) {
4352
// Serve some instructions at /
@@ -99,9 +108,15 @@ async fn req_handler(req: Request<Body>) -> Result<Response<Body>, hyper::Error>
99108
}
100109
}
101110

111+
#[deprecated(
112+
since = "0.8.24",
113+
note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
114+
)]
102115
pub async fn run<A: Into<SocketAddr>>(
103116
addr: A,
104117
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
118+
println!("WARNING: The HTTP server is deprecated, and will be removed in v0.9.0. Please see https://github.com/reacherhq/backend for a replacement.");
119+
105120
let service = make_service_fn(|_| async { Ok::<_, hyper::Error>(service_fn(req_handler)) });
106121

107122
let addr = addr.into();

src/main.rs

+19-4
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,34 @@ pub struct Cli {
5151
/// The email to check.
5252
pub to_email: Option<String>,
5353

54-
/// Runs a HTTP server.
54+
/// DEPRECATED. Runs a HTTP server.
55+
/// This option will be removed in v0.9.0.
5556
#[clap(long)]
57+
#[deprecated(
58+
since = "0.8.24",
59+
note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
60+
)]
5661
pub http: bool,
5762

58-
/// Sets the host IP address on which the HTTP server should bind.
63+
/// DEPRECATED. Sets the host IP address on which the HTTP server should bind.
5964
/// Only used when `--http` flag is on.
65+
/// This option will be removed in v0.9.0.
6066
#[clap(long, env = "HOST", default_value = "127.0.0.1")]
67+
#[deprecated(
68+
since = "0.8.24",
69+
note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
70+
)]
6171
pub http_host: IpAddr,
6272

63-
/// Sets the port on which the HTTP server should bind.
73+
/// DEPRECATED. Sets the port on which the HTTP server should bind.
6474
/// Only used when `--http` flag is on.
6575
/// If not set, then it will use $PORT, or default to 3000.
76+
/// This option will be removed in v0.9.0.
6677
#[clap(long, env = "PORT", default_value = "3000")]
78+
#[deprecated(
79+
since = "0.8.24",
80+
note = "The HTTP server will be removed from the CLI, please use https://github.com/reacherhq/backend instead"
81+
)]
6782
pub http_port: u16,
6883
}
6984

@@ -99,7 +114,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
99114
};
100115
}
101116

102-
// Run the web server if flag is on
117+
// Run the web server if --http flag is on.
103118
if CONF.http {
104119
http::run((CONF.http_host, CONF.http_port)).await?;
105120
}

test_suite/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "check-if-email-exists-test-suite"
3-
version = "0.8.23"
3+
version = "0.8.24"
44
edition = "2018"
55
publish = false
66

0 commit comments

Comments
 (0)