Skip to content

Commit

Permalink
sources: Allow configuring a custom AWS region
Browse files Browse the repository at this point in the history
This can be useful when using an s3 compatible service, such as minio or
Ceph.
  • Loading branch information
brancz committed May 31, 2021
1 parent f85460a commit a9ca91f
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions crates/symbolicator/src/sources.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
//! Download sources types and related implementations.

use anyhow::Result;
use std::collections::BTreeMap;
use std::fmt;
use std::path::PathBuf;
use std::sync::Arc;

use serde::{Deserialize, Deserializer, Serialize};
use serde::{Deserialize, Serialize};
use url::Url;

use crate::types::{Glob, ObjectId, ObjectType};
Expand Down Expand Up @@ -123,20 +122,6 @@ pub struct FilesystemSourceConfig {
pub files: CommonSourceConfig,
}

/// Local helper to deserializes an S3 region string in `S3SourceKey`.
fn deserialize_region<'de, D>(deserializer: D) -> Result<rusoto_core::Region, D::Error>
where
D: Deserializer<'de>,
{
// For safety reason we only want to parse the default AWS regions so that
// non AWS services cannot be accessed.
use serde::de::Error as _;
let region = String::deserialize(deserializer)?;
region
.parse()
.map_err(|e| D::Error::custom(format!("region: {}", e)))
}

/// The types of Amazon IAM credentials providers we support.
///
/// For details on the AWS side, see:
Expand All @@ -158,7 +143,7 @@ impl Default for AwsCredentialsProvider {
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct S3SourceKey {
/// The region of the S3 bucket.
#[serde(deserialize_with = "deserialize_region")]
#[serde(default)]
pub region: rusoto_core::Region,

/// AWS IAM credentials provider for obtaining S3 access.
Expand Down

0 comments on commit a9ca91f

Please sign in to comment.