pub struct UploaderConfig {
pub endpoint: String,
pub region: String,
pub bucket: String,
pub public_base_url: String,
pub key_prefix: Option<String>,
pub access_key_id: String,
pub secret_access_key: String,
pub download_timeout: Duration,
pub max_file_size: u64,
pub max_buffered_bytes: u64,
}Expand description
Configuration for the Garage uploader.
Use UploaderConfigBuilder to construct this.
Fields§
§endpoint: StringS3-compatible endpoint URL (e.g., “https://s3.example.com”)
region: StringS3 region (e.g., “garage” or “us-east-1”)
bucket: StringTarget bucket name
public_base_url: StringPublic CDN base URL for constructing public URLs
key_prefix: Option<String>Optional prefix for all uploaded keys (e.g., “uploads/”)
access_key_id: StringAWS/Garage access key ID
secret_access_key: StringAWS/Garage secret access key
download_timeout: DurationHTTP client timeout for downloads
max_file_size: u64Maximum file size in bytes (default: 100MB)
max_buffered_bytes: u64Maximum size in bytes to buffer in memory when downloading (default: 8MB).
Responses larger than this (or with unknown Content-Length) are streamed and
still capped by max_file_size.
Implementations§
Source§impl UploaderConfig
impl UploaderConfig
Sourcepub fn builder() -> UploaderConfigBuilder
pub fn builder() -> UploaderConfigBuilder
Create a new configuration builder.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create a configuration from environment variables.
Reads the following environment variables:
GARAGE_ENDPOINTorS3_ENDPOINTGARAGE_REGIONorS3_REGION(optional, defaults to “garage”)GARAGE_BUCKETorS3_BUCKETGARAGE_PUBLIC_URLorS3_PUBLIC_URLGARAGE_KEY_PREFIXorS3_KEY_PREFIX(optional)AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEY
Sourcepub fn from_secret_dir(path: impl AsRef<Path>) -> Result<Self>
pub fn from_secret_dir(path: impl AsRef<Path>) -> Result<Self>
Create a configuration from a directory of secret files.
Expected filenames:
endpointregion(optional, defaults to “garage”)bucketpublic_urlkey_prefix(optional)access_key_idsecret_access_key
Sourcepub fn from_secret_dir_with_names(
path: impl AsRef<Path>,
names: &SecretFileNames,
) -> Result<Self>
pub fn from_secret_dir_with_names( path: impl AsRef<Path>, names: &SecretFileNames, ) -> Result<Self>
Create a configuration from a directory of secret files with custom filenames.
Sourcepub fn from_env_or_secret_dir(path: impl AsRef<Path>) -> Result<Self>
pub fn from_env_or_secret_dir(path: impl AsRef<Path>) -> Result<Self>
Create a configuration from environment variables, falling back to a secret directory.
Trait Implementations§
Source§impl Clone for UploaderConfig
impl Clone for UploaderConfig
Source§fn clone(&self) -> UploaderConfig
fn clone(&self) -> UploaderConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for UploaderConfig
impl RefUnwindSafe for UploaderConfig
impl Send for UploaderConfig
impl Sync for UploaderConfig
impl Unpin for UploaderConfig
impl UnwindSafe for UploaderConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more