Skip to content

Commit

Permalink
fix: Migrate to new Remi APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
spotlightishere committed Dec 14, 2024
1 parent afe3601 commit 33bb267
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
5 changes: 4 additions & 1 deletion crates/app/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ impl Context {
storage::Config::Filesystem(fs) => {
StorageService::Filesystem(azalia::remi::fs::StorageService::with_config(fs))
}
storage::Config::Azure(azure) => StorageService::Azure(azalia::remi::azure::StorageService::new(azure)),
storage::Config::Azure(azure) => StorageService::Azure(
azalia::remi::azure::StorageService::new(azure)
.expect("should be able to create Azure storage service"),
),
storage::Config::S3(s3) => StorageService::S3(azalia::remi::s3::StorageService::new(s3)),
};

Expand Down
26 changes: 11 additions & 15 deletions crates/config/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use azalia::{
TRUTHY_REGEX,
};
use eyre::{eyre, Context, Report};
use remi_azure::{core::storage::CloudLocation, Credential};
use remi_azure::{CloudLocation, Credential};
use remi_s3::aws::s3::{
config::Region,
types::{BucketCannedAcl, ObjectCannedAcl},
Expand Down Expand Up @@ -84,16 +84,12 @@ impl Merge for Config {
me.container.merge(other.container);

match (&me.location, &other.location) {
(CloudLocation::Public { account: acc1 }, CloudLocation::Public { account: acc2 })
if acc1 != acc2 =>
{
me.location = CloudLocation::Public { account: acc2.clone() };
(CloudLocation::Public(acc1), CloudLocation::Public(acc2)) if acc1 != acc2 => {
me.location = CloudLocation::Public(acc2.clone());
}

(CloudLocation::China { account: acc1 }, CloudLocation::China { account: acc2 })
if acc1 != acc2 =>
{
me.location = CloudLocation::China { account: acc2.clone() };
(CloudLocation::China(acc1), CloudLocation::China(acc2)) if acc1 != acc2 => {
me.location = CloudLocation::China(acc2.clone());
}

(
Expand Down Expand Up @@ -264,15 +260,15 @@ fn to_env_credentials() -> eyre::Result<Credential> {
fn to_env_location() -> eyre::Result<CloudLocation> {
match env!("CHARTED_STORAGE_AZURE_LOCATION") {
Ok(res) => match res.as_str() {
"public" => Ok(CloudLocation::Public {
account: env!("CHARTED_STORAGE_AZURE_ACCOUNT")
"public" => Ok(CloudLocation::Public(
env!("CHARTED_STORAGE_AZURE_ACCOUNT")
.context("missing required env [CHARTED_STORAGE_AZURE_ACCOUNT]")?,
}),
)),

"china" => Ok(CloudLocation::China {
account: env!("CHARTED_STORAGE_AZURE_ACCOUNT")
"china" => Ok(CloudLocation::China(
env!("CHARTED_STORAGE_AZURE_ACCOUNT")
.context("missing required env [CHARTED_STORAGE_AZURE_ACCOUNT]")?,
}),
)),

"emulator" => Ok(CloudLocation::Emulator {
address: env!("CHARTED_STORAGE_AZURE_EMULATOR_ADDRESS")
Expand Down

0 comments on commit 33bb267

Please sign in to comment.