This commit is contained in:
parent
4e125c611c
commit
fb0fa1f351
7 changed files with 16 additions and 18 deletions
|
@ -15,4 +15,4 @@ COPY --from=builder /app/target/release/pacco /usr/bin/pacco
|
||||||
|
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
CMD ["/usr/bin/pacco", "serve", "/config.toml"]
|
CMD ["/usr/bin/pacco", "serve", "--config", "/config.toml"]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use serde::Deserialize;
|
|
||||||
use crate::Architecture;
|
use crate::Architecture;
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Default)]
|
#[derive(Debug, Clone, Deserialize, Default)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
@ -15,21 +15,15 @@ pub struct MirrorConfig {
|
||||||
#[derive(Debug, Clone, Deserialize, Default)]
|
#[derive(Debug, Clone, Deserialize, Default)]
|
||||||
pub struct Mirrorlist {
|
pub struct Mirrorlist {
|
||||||
pub x86_64: Vec<String>,
|
pub x86_64: Vec<String>,
|
||||||
pub aarch64: Vec<String>
|
pub aarch64: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Mirrorlist {
|
impl Mirrorlist {
|
||||||
pub fn for_arch(&self, arch: Architecture) -> &[String] {
|
pub fn for_arch(&self, arch: Architecture) -> &[String] {
|
||||||
match arch {
|
match arch {
|
||||||
Architecture::x86_64 => {
|
Architecture::x86_64 => &self.x86_64,
|
||||||
&self.x86_64
|
Architecture::aarch64 => &self.aarch64,
|
||||||
},
|
Architecture::any => &self.x86_64,
|
||||||
Architecture::aarch64 => {
|
|
||||||
&self.aarch64
|
|
||||||
},
|
|
||||||
Architecture::any => {
|
|
||||||
&self.x86_64
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
pub mod pkg;
|
|
||||||
pub mod config;
|
pub mod config;
|
||||||
|
pub mod pkg;
|
||||||
use pkg::arch::Architecture;
|
use pkg::arch::Architecture;
|
|
@ -25,7 +25,7 @@ async fn launch(config: String) {
|
||||||
let pg = get_pg!();
|
let pg = get_pg!();
|
||||||
sqlx::migrate!("./migrations").run(pg).await.unwrap();
|
sqlx::migrate!("./migrations").run(pg).await.unwrap();
|
||||||
|
|
||||||
let config: Config =
|
let config: pacco::config::Config =
|
||||||
toml::from_str(&std::fs::read_to_string(&config).unwrap_or_default()).unwrap_or_default();
|
toml::from_str(&std::fs::read_to_string(&config).unwrap_or_default()).unwrap_or_default();
|
||||||
|
|
||||||
let _ = User::create("admin".to_string(), "admin", based::auth::UserRole::Admin).await;
|
let _ = User::create("admin".to_string(), "admin", based::auth::UserRole::Admin).await;
|
||||||
|
|
|
@ -88,7 +88,11 @@ impl MirrorRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the `.db.tar.gz.sig` content for the repository of `arch`
|
/// Get the `.db.tar.gz.sig` content for the repository of `arch`
|
||||||
pub async fn sig_content(&self, arch: Architecture, mirrorlist: &Mirrorlist) -> Option<Vec<u8>> {
|
pub async fn sig_content(
|
||||||
|
&self,
|
||||||
|
arch: Architecture,
|
||||||
|
mirrorlist: &Mirrorlist,
|
||||||
|
) -> Option<Vec<u8>> {
|
||||||
self.download_file(
|
self.download_file(
|
||||||
&format!("{}.db.tar.gz.sig", self.inner.name),
|
&format!("{}.db.tar.gz.sig", self.inner.name),
|
||||||
self.inner
|
self.inner
|
||||||
|
|
|
@ -13,7 +13,7 @@ use pacco::pkg::arch::Architecture;
|
||||||
use rocket::form::Form;
|
use rocket::form::Form;
|
||||||
use rocket::fs::TempFile;
|
use rocket::fs::TempFile;
|
||||||
|
|
||||||
use crate::config::Config;
|
use pacco::config::Config;
|
||||||
|
|
||||||
#[derive(FromForm)]
|
#[derive(FromForm)]
|
||||||
pub struct PkgUpload<'r> {
|
pub struct PkgUpload<'r> {
|
||||||
|
|
|
@ -7,8 +7,8 @@ use rocket::{State, get};
|
||||||
|
|
||||||
use pacco::pkg::{Repository, arch::Architecture};
|
use pacco::pkg::{Repository, arch::Architecture};
|
||||||
|
|
||||||
use crate::config::Config;
|
|
||||||
use crate::routes::ui::arch_card;
|
use crate::routes::ui::arch_card;
|
||||||
|
use pacco::config::Config;
|
||||||
|
|
||||||
#[get("/<repo>?<arch>&<sort>")]
|
#[get("/<repo>?<arch>&<sort>")]
|
||||||
pub async fn repo_ui(
|
pub async fn repo_ui(
|
||||||
|
|
Loading…
Add table
Reference in a new issue