started gitea api impl

This commit is contained in:
2026-06-02 19:52:50 +00:00
parent 1f60f6572f
commit 10ebee389e
6 changed files with 91 additions and 21 deletions
+10 -9
View File
@@ -1,8 +1,4 @@
use std::sync::Arc;
use tokio::sync::Mutex;
use crate::{bot::Bot, state::AppState};
use crate::{bot::Bot, gitea::WebhookType, state::AppState};
mod api;
mod bot;
@@ -15,11 +11,16 @@ mod state;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = env::load_config()?;
let bot = Bot::new(config.clone());
let (tx, rx) = tokio::sync::mpsc::channel::<WebhookType>(1);
let app_state = AppState {
bot: Arc::new(Mutex::new(Bot::new(config.clone()))),
config: config,
bot_tx: tx,
config,
};
api::start(app_state).await
}
tokio::try_join!(bot.start(rx), api::start(app_state))?;
Ok(())
}