refactor: Move logging out of object store configuration validation
@@ -98,13 +98,21 @@ pub async fn main(logging_level: LoggingLevel, config: Option<Config>) -> Result
let f = SendPanicsToTracing::new();
std::mem::forget(f);
+ match config.object_store {
+ Some(ObjStoreOpt::Memory) | None => {
+ warn!("NO PERSISTENCE: using Memory for object storage");
+ }
+ Some(store) => {
+ info!("Using {} for object storage", store);
+ }
+ }
+
let object_store = match (
config.object_store,
config.bucket,
config.database_directory,
) {
(Some(ObjStoreOpt::Google), Some(bucket), _) => {
- info!("Using GCP bucket {} for storage", bucket);
ObjectStore::new_google_cloud_storage(GoogleCloudStorage::new(bucket))
}
(Some(ObjStoreOpt::Google), None, _) => {
@@ -114,7 +122,6 @@ pub async fn main(logging_level: LoggingLevel, config: Option<Config>) -> Result
.fail();
}
(Some(ObjStoreOpt::S3), Some(bucket), _) => {
- info!("Using S3 bucket {} for storage", bucket);
// rusoto::Region's default takes the value from the AWS_DEFAULT_REGION env var.
ObjectStore::new_amazon_s3(AmazonS3::new(Default::default(), bucket))
}
@@ -125,7 +132,6 @@ pub async fn main(logging_level: LoggingLevel, config: Option<Config>) -> Result
.fail();
}
(Some(ObjStoreOpt::File), _, Some(ref db_dir)) => {
- info!("Using local dir {:?} for storage", db_dir);
fs::create_dir_all(db_dir).context(CreatingDatabaseDirectory { path: db_dir })?;
ObjectStore::new_file(object_store::disk::File::new(&db_dir))
}
@@ -142,7 +148,6 @@ pub async fn main(logging_level: LoggingLevel, config: Option<Config>) -> Result
.fail();
}
(Some(ObjStoreOpt::Memory), _, _) | (None, _, _) => {
- warn!("NO PERSISTENCE: using memory for object storage");
ObjectStore::new_in_memory(object_store::memory::InMemory::new())
}
};
