2024-08-02 15:45:59 +00:00
|
|
|
use object_store::aws::{AmazonS3, AmazonS3Builder};
|
|
|
|
use serde::Deserialize;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
|
|
pub struct MirrorConfig {
|
|
|
|
/// URI to Hydra instance
|
|
|
|
pub hydra_uri: String,
|
|
|
|
/// URI to the binary cache
|
|
|
|
pub binary_cache_uri: String,
|
|
|
|
/// Base URI to access to a web interface pertaining to a specific Git revision of the nixpkgs
|
|
|
|
/// input
|
|
|
|
pub base_git_uri_for_revision: String,
|
2024-12-14 17:10:43 +00:00
|
|
|
/// A path to a checkout of the target repository
|
|
|
|
pub repo_dir: PathBuf,
|
2024-08-02 15:45:59 +00:00
|
|
|
/// S3 releases bucket name
|
|
|
|
pub s3_release_bucket_name: String,
|
|
|
|
/// S3 channels bucket name
|
|
|
|
s3_channel_bucket_name: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl MirrorConfig {
|
|
|
|
pub fn release_bucket(&self) -> AmazonS3 {
|
|
|
|
AmazonS3Builder::from_env()
|
|
|
|
.with_bucket_name(&self.s3_release_bucket_name)
|
|
|
|
.build()
|
|
|
|
.expect("Failed to connect to the S3 release bucket")
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn channel_bucket(&self) -> AmazonS3 {
|
|
|
|
AmazonS3Builder::from_env()
|
|
|
|
.with_bucket_name(&self.s3_channel_bucket_name)
|
|
|
|
.build()
|
|
|
|
.expect("Failed to connect to the S3 channel bucket")
|
|
|
|
}
|
|
|
|
}
|