started gitea api impl
This commit is contained in:
+10
-9
@@ -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(())
|
||||
}
|
||||
Reference in New Issue
Block a user