Add techdocs.publisher.awsS3.endpoint config option

Signed-off-by: r.bideau <7304827+rbideau@users.noreply.github.com>
This commit is contained in:
r.bideau
2021-03-08 13:54:08 +01:00
parent 29e98205f1
commit ca4a904f6b
4 changed files with 27 additions and 3 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/techdocs-common': patch
'@backstage/plugin-techdocs': patch
---
Add an optional configuration option for setting the url endpoint for AWS S3 publisher: `techdocs.publisher.awsS3.endpoint`
+6
View File
@@ -76,6 +76,12 @@ techdocs:
region:
$env: AWS_REGION
# (Optional) Endpoint URI to send requests to.
# If not set, the default endpoint is built from the configured region.
# https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property
endpoint:
$env: AWS_ENDPOINT
# Required when techdocs.publisher.type is set to 'azureBlobStorage'. Skip otherwise.
azureBlobStorage:
@@ -94,11 +94,16 @@ export class AwsS3Publish implements PublisherBase {
// or AWS shared credentials file at ~/.aws/credentials will be used.
const region = config.getOptionalString('techdocs.publisher.awsS3.region');
// AWS endpoint is an optional config. If missing, the default endpoint is built from
// the configured region.
const endpoint = config.getOptionalString(
'techdocs.publisher.awsS3.endpoint',
);
const storageClient = new aws.S3({
credentials,
...(region && {
region,
}),
...(region && { region }),
...(endpoint && { endpoint }),
});
// Check if the defined bucket exists. Being able to connect means the configuration is good
+7
View File
@@ -83,6 +83,13 @@ export interface Config {
* @visibility secret
*/
region?: string;
/**
* (Optional) AWS Endpoint.
* The endpoint URI to send requests to. The default endpoint is built from the configured region.
* @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#constructor-property
* @visibility secret
*/
endpoint?: string;
};
}
| {