Skip to content

Commit 9d625a8

Browse files
Merge pull request #142 from code0-tech/132-hyper-base
Hyper As Base for Rest Adapter
2 parents b3a1353 + 7100a85 commit 9d625a8

File tree

12 files changed

+421
-1030
lines changed

12 files changed

+421
-1030
lines changed

Cargo.lock

Lines changed: 24 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[workspace]
2-
members = ["crates/http", "adapter/rest", "crates/base"]
2+
members = ["adapter/rest", "crates/base"]
33
resolver = "3"
44

55
[workspace.package]
@@ -23,8 +23,5 @@ prost = "0.14.0"
2323
tonic-health = "0.14.0"
2424
futures-lite = "2.6.1"
2525

26-
[workspace.dependencies.http]
27-
path = "../draco/crates/http"
28-
2926
[workspace.dependencies.base]
3027
path = "../draco/crates/base"

adapter/rest/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ version = "0.1.0"
44
edition.workspace = true
55

66
[dependencies]
7-
http = { workspace = true }
87
code0-flow = { workspace = true }
98
tokio = { workspace = true }
109
tucana = { workspace = true }
@@ -14,3 +13,7 @@ regex = { workspace = true }
1413
tonic = { workspace = true }
1514
base = { workspace = true }
1615
anyhow = { workspace = true }
16+
hyper-util = "0.1.19"
17+
hyper = "1.8.1"
18+
http-body-util = "0.1.3"
19+
prost = { workspace = true }

adapter/rest/src/config.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
use base::traits::LoadConfig;
2+
use code0_flow::flow_config::env_with_default;
3+
4+
#[derive(Clone)]
5+
pub struct HttpServerConfig {
6+
pub port: u16,
7+
pub host: String,
8+
}
9+
10+
impl LoadConfig for HttpServerConfig {
11+
fn load() -> Self {
12+
Self {
13+
port: env_with_default("HTTP_SERVER_PORT", 8080),
14+
host: env_with_default("HTTP_SERVER_HOST", String::from("127.0.0.1")),
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)