raito
a08351a9d4
This time, we have almost a complete mechanism! Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
37 lines
1.1 KiB
Rust
37 lines
1.1 KiB
Rust
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,
|
|
/// A path to a checkout of the target repository
|
|
pub repo_dir: PathBuf,
|
|
/// 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")
|
|
}
|
|
}
|