Skip to content
This repository was archived by the owner on Feb 8, 2024. It is now read-only.

Commit c3bf855

Browse files
committed
move config and server modules to capture crate
1 parent 867403e commit c3bf855

File tree

10 files changed

+18
-12
lines changed

10 files changed

+18
-12
lines changed

Cargo.lock

Lines changed: 1 addition & 0 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ rdkafka = { version = "0.34", features = ["cmake-build", "ssl"] }
2929
metrics = "0.21.1"
3030
metrics-exporter-prometheus = "0.12.1"
3131
thiserror = "1.0.48"
32+
envconfig = "0.10.0"

capture-server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ edition = "2021"
66
[dependencies]
77
axum = { workspace = true }
88
capture = { path = "../capture" }
9-
envconfig = "0.10.0"
109
time = { workspace = true }
1110
tokio = { workspace = true }
1211
tracing = { workspace = true }
1312
tracing-subscriber = { workspace = true }
13+
envconfig = { workspace = true }
1414

1515
[dev-dependencies]
1616
anyhow = { workspace = true, features = [] }

capture-server/src/lib.rs

Lines changed: 0 additions & 2 deletions
This file was deleted.

capture-server/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use envconfig::Envconfig;
21
use std::net::TcpListener;
32

4-
use capture_server::config::Config;
3+
use envconfig::Envconfig;
54
use tokio::signal;
65

7-
use capture_server::server::serve;
6+
use capture::config::Config;
7+
use capture::server::serve;
88

99
async fn shutdown() {
1010
let mut term = signal::unix::signal(signal::unix::SignalKind::terminate())

capture-server/tests/common.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ use rdkafka::{Message, TopicPartitionList};
1919
use tokio::sync::Notify;
2020
use tracing::debug;
2121

22-
use capture_server::config::Config;
23-
use capture_server::server::serve;
22+
use capture::config::Config;
23+
use capture::server::serve;
2424

2525
pub static DEFAULT_CONFIG: Lazy<Config> = Lazy::new(|| Config {
2626
print_sink: false,

capture/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ metrics = { workspace = true }
3030
metrics-exporter-prometheus = { workspace = true }
3131
thiserror = { workspace = true }
3232
redis = { version="0.23.3", features=["tokio-comp", "cluster", "cluster-async"] }
33+
envconfig = { workspace = true }
3334

3435
[dev-dependencies]
3536
assert-json-diff = { workspace = true }

capture-server/src/config.rs renamed to capture/src/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use envconfig::Envconfig;
21
use std::net::SocketAddr;
32

3+
use envconfig::Envconfig;
4+
45
#[derive(Envconfig, Clone)]
56
pub struct Config {
67
#[envconfig(default = "false")]

capture/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
pub mod api;
22
pub mod billing_limits;
33
pub mod capture;
4+
pub mod config;
45
pub mod event;
56
pub mod prometheus;
67
pub mod redis;
78
pub mod router;
9+
pub mod server;
810
pub mod sink;
911
pub mod time;
1012
pub mod token;

capture-server/src/server.rs renamed to capture/src/server.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ use std::sync::Arc;
44

55
use time::Duration;
66

7+
use crate::billing_limits::BillingLimiter;
78
use crate::config::Config;
8-
use capture::{billing_limits::BillingLimiter, redis::RedisClient, router, sink};
9+
use crate::redis::RedisClient;
10+
use crate::{router, sink};
911

1012
pub async fn serve<F>(config: Config, listener: TcpListener, shutdown: F)
1113
where
@@ -19,7 +21,7 @@ where
1921

2022
let app = if config.print_sink {
2123
router::router(
22-
capture::time::SystemTime {},
24+
crate::time::SystemTime {},
2325
sink::PrintSink {},
2426
redis_client,
2527
billing,
@@ -30,7 +32,7 @@ where
3032
sink::KafkaSink::new(config.kafka_topic, config.kafka_hosts, config.kafka_tls).unwrap();
3133

3234
router::router(
33-
capture::time::SystemTime {},
35+
crate::time::SystemTime {},
3436
sink,
3537
redis_client,
3638
billing,

0 commit comments

Comments
 (0)