feat: setup federation file writes

This commit is contained in:
Aravinth Manivannan 2022-05-17 20:12:14 +05:30
parent 519855a7c3
commit f03bd5aaae
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88
4 changed files with 40 additions and 0 deletions

3
Cargo.lock generated
View file

@ -2201,10 +2201,13 @@ dependencies = [
"db-core",
"db-sqlx-sqlite",
"derive_more",
"federate-core",
"forge-core",
"gitea",
"lazy_static",
"log",
"mktemp",
"publiccodeyml",
"rand",
"reqwest",
"serde",

View file

@ -65,6 +65,15 @@ path = "./forge/gitea"
[dependencies.forge-core]
path = "./forge/forge-core"
[dependencies.federate-core]
path = "./federate/federate-core"
[dependencies.publiccodeyml]
path = "./federate/publiccodeyml"
[dependencies.sqlx]
features = ["runtime-actix-rustls", "uuid", "postgres", "time", "offline", "sqlite"]
version = "0.5.11"
[dev-dependencies]
mktemp = "0.4.1"

27
src/federate.rs Normal file
View file

@ -0,0 +1,27 @@
/*
* Copyright (C) 2022 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use crate::settings::Settings;
use federate_core::Federate;
use publiccodeyml::{errors::FederateErorr, PccFederate};
pub type BoxFederate = Box<dyn Federate<Error = FederateErorr>>;
pub async fn get_federate(settings: Option<Settings>) -> BoxFederate {
let settings = settings.unwrap_or_else(|| Settings::new().unwrap());
Box::new(PccFederate::new(settings.repository.root).await.unwrap())
}

View file

@ -17,6 +17,7 @@
*/
pub mod ctx;
pub mod db;
pub mod federate;
pub mod forge;
pub mod settings;
pub mod spider;