Repository: influxdata/influxdb
File: influxdb3_clap_blocks/src/object_store.rs (Rust)

Code before:
                #[cfg(not(feature = "aws"))]
                fn new_s3(&self) -> Result<Arc<DynObjectStore>, ParseError> {
                    panic!("S3 support not enabled, recompile with the aws feature enabled")
                }

                #[cfg(feature = "azure")]
                fn new_azure(&self) -> Result<Arc<DynObjectStore>, ParseError> {
                    use object_store::azure::MicrosoftAzureBuilder;
                    use object_store::limit::LimitStore;

                    info!(bucket=?self.bucket, account=?self.azure_storage_account,
                          endpoint=?self.azure_endpoint, object_store_type="Azure", "Object Store");

                    let mut builder = MicrosoftAzureBuilder::new().with_client_options(self.client_options());

                    if let Some(bucket) = &self.bucket {
                        builder = builder.with_container_name(bucket);
                    }
                    if let Some(account) = &self.azure_storage_account {
                        builder = builder.with_account(account);
                    }
                    if let Some(key) = &self.azure_storage_access_key {
                        builder = builder.with_access_key(key);
                    }
                    if let Some(endpoint) = &self.azure_endpoint {
                        builder = builder.with_allow_http(true);
                        builder = builder.with_endpoint(endpoint.to_string());
                    }

                    Ok(Arc::new(LimitStore::new(
                        builder.build().context(InvalidAzureConfigSnafu)?,
                        self.object_store_connection_limit.get(),
                    )))
                }

                #[cfg(not(feature = "azure"))]
                fn new_azure(&self) -> Result<Arc<DynObjectStore>, ParseError> {
                    panic!("Azure blob storage support not enabled, recompile with the azure feature enabled")
                }

                /// Build cache store.
                #[cfg(feature = "aws")]
                pub fn make_cache_store(
                    &self
                ) -> Result<Option<Arc<DynObjectStore>>, ParseError> {
                    let Some(endpoint) = &self.cache_endpoint else {
                        return Ok(None);
                    };

                    let store = Arc::new(object_store::aws::AmazonS3Builder::from_env()
                        // bucket name is ignored by our cache server

Review comment (suggestion):
I agree with @peterbarnett03 on this, the user should be able to pass a flag that sets the allow http flag.

Code after:
                    Ok(r)
                }

                #[cfg(feature = "aws")]
                pub fn build_s3_signer(&self) -> Result<object_store::aws::AmazonS3, ParseError> {
                    let builder = self.s3_builder()?;

                    builder.build().context(InvalidS3ConfigSnafu)
                }

                #[cfg(not(feature = "aws"))]
                fn new_s3(&self) -> Result<Arc<DynObjectStore>, ParseError> {
                    panic!("S3 support not enabled, recompile with the aws feature enabled")
                }

                #[cfg(feature = "azure")]
                fn new_azure(&self) -> Result<Arc<DynObjectStore>, ParseError> {
                    use object_store::azure::MicrosoftAzureBuilder;
                    use object_store::limit::LimitStore;

                    info!(bucket=?self.bucket, account=?self.azure_storage_account,
                          endpoint=?self.azure_endpoint, object_store_type="Azure", "Object Store");

                    let mut builder = MicrosoftAzureBuilder::new().with_client_options(self.client_options());

                    if let Some(bucket) = &self.bucket {
                        builder = builder.with_container_name(bucket);
                    }
                    if let Some(account) = &self.azure_storage_account {
                        builder = builder.with_account(account);
                    }
                    if let Some(key) = &self.azure_storage_access_key {
                        builder = builder.with_access_key(key);
                    }

                    builder = builder.with_allow_http(self.azure_allow_http);

                    if let Some(endpoint) = &self.azure_endpoint {
                        builder = builder.with_endpoint(endpoint.to_string());
                    }

                    Ok(Arc::new(LimitStore::new(
                        builder.build().context(InvalidAzureConfigSnafu)?,
                        self.object_store_connection_limit.get(),
                    )))
                }

                #[cfg(not(feature = "azure"))]
                fn new_azure(&self) -> Result<Arc<DynObjectStore>, ParseError> {
                    panic!("Azure blob storage support not enabled, recompile with the azure feature enabled")
                }