2023-07-16 20:52:03 +02:00
|
|
|
mod cli;
|
2023-07-30 15:52:11 +02:00
|
|
|
mod db;
|
2023-07-14 13:46:53 +02:00
|
|
|
mod error;
|
2023-07-11 13:41:56 +02:00
|
|
|
mod repo;
|
2023-07-30 16:55:44 +02:00
|
|
|
mod api;
|
2023-07-11 13:41:56 +02:00
|
|
|
|
2023-07-16 20:52:03 +02:00
|
|
|
use clap::Parser;
|
2023-07-14 13:46:53 +02:00
|
|
|
pub use error::{Result, ServerError};
|
2023-07-13 14:58:27 +02:00
|
|
|
use repo::RepoGroupManager;
|
2023-07-11 13:41:56 +02:00
|
|
|
use std::path::PathBuf;
|
2023-07-13 16:39:52 +02:00
|
|
|
use std::sync::{Arc, RwLock};
|
2023-07-30 16:55:44 +02:00
|
|
|
use sea_orm::DatabaseConnection;
|
2023-07-11 13:41:56 +02:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct Config {
|
|
|
|
repo_dir: PathBuf,
|
|
|
|
pkg_dir: PathBuf,
|
|
|
|
}
|
|
|
|
|
2023-07-13 14:58:27 +02:00
|
|
|
#[derive(Clone)]
|
|
|
|
pub struct Global {
|
|
|
|
config: Config,
|
|
|
|
repo_manager: Arc<RwLock<RepoGroupManager>>,
|
2023-07-30 16:55:44 +02:00
|
|
|
db: DatabaseConnection
|
2023-07-13 14:58:27 +02:00
|
|
|
}
|
|
|
|
|
2023-07-11 13:41:56 +02:00
|
|
|
#[tokio::main]
|
|
|
|
async fn main() {
|
2023-07-16 20:52:03 +02:00
|
|
|
let cli = cli::Cli::parse();
|
|
|
|
cli.run().await;
|
2023-07-11 13:41:56 +02:00
|
|
|
}
|