diff --git a/Dockerfile b/Dockerfile index 3f1183c..848b424 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,12 @@ FROM rust:latest - +LABEL org.opencontainers.image.source = "https://github.com/FyraLabs/skystreamer" WORKDIR /usr/src/app COPY . . RUN cargo install --path skystreamer-bin +WORKDIR / +RUN rm -rf /usr/src/app + + CMD ["skystreamer"] \ No newline at end of file diff --git a/skystreamer-bin/src/config.rs b/skystreamer-bin/src/config.rs index bb250fe..6a0b933 100644 --- a/skystreamer-bin/src/config.rs +++ b/skystreamer-bin/src/config.rs @@ -185,6 +185,9 @@ pub struct Config { pub exporter: ExporterType, #[clap(flatten)] pub file_exporter: FileExporterOptions, + + #[clap(short = 'R', long, default_value = "bsky.network", env = "ATPROTO_RELAY")] + pub atproto_relay: String, } impl Config { @@ -212,6 +215,6 @@ impl Config { } }; - Ok(Consumer::new(exporter)) + Ok(Consumer::new(exporter, &self.atproto_relay)) } } diff --git a/skystreamer-bin/src/main.rs b/skystreamer-bin/src/main.rs index f16232c..dbf25a3 100644 --- a/skystreamer-bin/src/main.rs +++ b/skystreamer-bin/src/main.rs @@ -15,6 +15,7 @@ use update_rate::RateCounter; pub struct Consumer { rate_counter: update_rate::DiscreteRateCounter, exporter: Box, + pub atproto_relay: String, } // #[derive(Debug)] // pub struct TaskQueue { @@ -67,15 +68,16 @@ pub struct Consumer { // const GLOBAL_THREAD_POOL: OnceCell = OnceCell::new(); impl Consumer { - pub fn new(exporter: Box) -> Self { + pub fn new(exporter: Box, relay: &str) -> Self { Consumer { rate_counter: update_rate::DiscreteRateCounter::new(50), exporter, + atproto_relay: relay.to_string(), } } pub async fn start(&mut self) -> Result<()> { - let subscription = RepoSubscription::new("bsky.network").await.unwrap(); + let subscription = RepoSubscription::new(&self.atproto_relay).await.unwrap(); let post_stream = PostStream::new(subscription); let mut post_stream = post_stream.await;