@@ -167,13 +167,13 @@ async fn main() -> anyhow::Result<()> {
|
||||
std::env::var("SLACK_CLIENT_ID"),
|
||||
std::env::var("SLACK_CLIENT_SECRET"),
|
||||
) {
|
||||
let base_url = std::env::var("FORAGE_BASE_URL")
|
||||
let redirect_host = std::env::var("SLACK_REDIRECT_HOST")
|
||||
.unwrap_or_else(|_| format!("http://localhost:{port}"));
|
||||
tracing::info!("Slack OAuth enabled");
|
||||
state = state.with_slack_config(crate::state::SlackConfig {
|
||||
client_id,
|
||||
client_secret,
|
||||
base_url,
|
||||
redirect_host,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -197,9 +197,15 @@ async fn main() -> anyhow::Result<()> {
|
||||
state = state.with_integration_store(store.clone());
|
||||
|
||||
if let Ok(service_token) = std::env::var("FORAGE_SERVICE_TOKEN") {
|
||||
let forage_url = std::env::var("FORAGE_URL")
|
||||
.or_else(|_| std::env::var("SLACK_REDIRECT_HOST"))
|
||||
.unwrap_or_else(|_| format!("http://localhost:{port}"));
|
||||
|
||||
if let Some(ref js) = nats_jetstream {
|
||||
// JetStream mode: ingester publishes, consumer dispatches
|
||||
tracing::info!("starting notification pipeline (JetStream)");
|
||||
let grpc_for_consumer = forest_client.clone();
|
||||
let token_for_consumer = service_token.clone();
|
||||
mad.add(notification_ingester::NotificationIngester {
|
||||
grpc: forest_client,
|
||||
jetstream: js.clone(),
|
||||
@@ -208,6 +214,9 @@ async fn main() -> anyhow::Result<()> {
|
||||
mad.add(notification_consumer::NotificationConsumer {
|
||||
jetstream: js.clone(),
|
||||
store: store.clone(),
|
||||
forage_url,
|
||||
grpc: grpc_for_consumer,
|
||||
service_token: token_for_consumer,
|
||||
});
|
||||
} else {
|
||||
// Fallback: direct dispatch (no durability)
|
||||
@@ -216,6 +225,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
grpc: forest_client,
|
||||
store: store.clone(),
|
||||
service_token,
|
||||
forage_url,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user