Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,4 @@ The following, optional environment variables may be added to configure extensio
| NIFI_REGISTRY_S3_ACCESS_KEY | Access Key |
| NIFI_REGISTRY_S3_SECRET_ACCESS_KEY | Secret Access Key |
| NIFI_REGISTRY_S3_ENDPOINT_URL | Endpoint URL |

| NIFI_REGISTRY_S3_FORCE_PATH_STYLE | Force Path Style |
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ case ${NIFI_REGISTRY_BUNDLE_PROVIDER} in
add_property "Access Key" "${NIFI_REGISTRY_S3_ACCESS_KEY:-}"
add_property "Secret Access Key" "${NIFI_REGISTRY_S3_SECRET_ACCESS_KEY:-}"
add_property "Endpoint URL" "${NIFI_REGISTRY_S3_ENDPOINT_URL:-}"
add_property "Force Path Style" "${NIFI_REGISTRY_S3_FORCE_PATH_STYLE:-}"
;;
esac
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,7 @@ Qualified class name: `org.apache.nifi.registry.aws.S3BundlePersistenceProvider`
|`Access Key`| The access key to use when using `STATIC` credentials provider.
|`Secret Access Key`| The secret access key to use when using `STATIC` credentials provider.
|`Endpoint URL`| An optional URL that overrides the default AWS S3 endpoint URL. Set this when using an AWS S3 API compatible service hosted at a different URL.
|`Force Path Style`| Optional boolean value (`true`/`false`) that controls the URL style used for S3 requests. Defaults to `false`, which uses virtual-hosted-style URLs (e.g., `https://bucket-name.s3.region.amazonaws.com/key`). Set to `true` to use path-style URLs (e.g., `https://s3.region.amazonaws.com/bucket-name/key`). Typically required for S3-compatible storage systems like MinIO, Ceph, or other non-AWS implementations.
|====

== Event Hooks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
- "Secret Access Key" - The secret access key to use when using STATIC credentials provider
- "Endpoint URL" - An optional URL that overrides the default AWS S3 endpoint URL.
Set this when using an AWS S3 API compatible service hosted at a different URL.
- "Force Path Style" - Optional boolean value (true/false) that controls the URL style used for S3 requests.
Defaults to false, which uses virtual-hosted-style URLs (e.g., https://bucket-name.s3.region.amazonaws.com/key).
Set to true to use path-style URLs (e.g., https://s3.region.amazonaws.com/bucket-name/key).
This is typically required for S3-compatible storage systems like MinIO, Ceph, or other non-AWS implementations.
-->
<!--
<extensionBundlePersistenceProvider>
Expand All @@ -94,6 +98,7 @@
<property name="Access Key"></property>
<property name="Secret Access Key"></property>
<property name="Endpoint URL"></property>
<property name="Force Path Style"></property>
</extensionBundlePersistenceProvider>
-->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Uncomment the extensionBundlePersistenceProvider for S3:
<property name="Access Key"></property>
<property name="Secret Access Key"></property>
<property name="Endpoint URL"></property>
<property name="Force Path Style"></property>
</extensionBundlePersistenceProvider>
-->
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class S3BundlePersistenceProvider implements BundlePersistenceProvider {
public static final String ACCESS_KEY_PROP = "Access Key";
public static final String SECRET_ACCESS_KEY_PROP = "Secret Access Key";
public static final String ENDPOINT_URL_PROP = "Endpoint URL";
public static final String FORCE_PATH_STYLE_PROP = "Force Path Style";

public static final String NAR_EXTENSION = ".nar";
public static final String CPP_EXTENSION = ".cpp";
Expand Down Expand Up @@ -102,10 +103,30 @@ protected S3Client createS3Client(final ProviderConfigurationContext configurati
builder.endpointOverride(s3EndpointOverride);
}

final boolean forcePathStyle = getForcePathStyle(configurationContext);
if (forcePathStyle) {
builder.forcePathStyle(forcePathStyle);
}

return builder.build();

}

private boolean getForcePathStyle(ProviderConfigurationContext configurationContext) {
final String forcePathStyleValue = configurationContext.getProperties().get(FORCE_PATH_STYLE_PROP);
if (StringUtils.isBlank(forcePathStyleValue)) {
LOGGER.debug("Force Path Style not specified, using default value: false");
return false;
}

try {
return Boolean.parseBoolean(forcePathStyleValue);
} catch (Exception e) {
LOGGER.warn("Invalid value for Force Path Style: '{}', using default value: false", forcePathStyleValue);
return false;
}
}

private Region getRegion(final ProviderConfigurationContext configurationContext) {
final String regionValue = configurationContext.getProperties().get(REGION_PROP);
if (StringUtils.isBlank(regionValue)) {
Expand Down
Loading