Support optional bucketRootPath in GCS and S3 techdocs publishers

- Updated app-config.yaml with additional configuration parameters:
    - techdocs.publisher.awsS3.bucketRootPath
    - techdocs.publisher.googleGcs.bucketRootPath
- Updated `fromConfig` and constructors to support additional `bucketRootPath`
  parameters.
- Updated publish method to support `bucketRootPath` in constructing destination
  file path
- Updated `fetchTechDocsMetadata` to use `bucketRootPath`
- Updated `docsRouter` to use `docsRouter` when retrieving files
    - When using both legacy casing, and a bucket root path, additional logic
      was added to prevent the root path's case from being modified as
      previously legacy casing would be applied to the first three entities of
      the URI
- Updated `hasDocsBeenGenerated` to use `bucketRootPath`
- Added additional unit tests for new configurations to updated, and new methods

Signed-off-by: Colton Padden <colton.padden@fastmail.com>
This commit is contained in:
Colton Padden
2021-10-11 10:49:40 -04:00
parent 54552e215d
commit d207f6ee9e
8 changed files with 380 additions and 12 deletions
+8
View File
@@ -63,6 +63,10 @@ techdocs:
# (Required) Cloud Storage Bucket Name
bucketName: 'techdocs-storage'
# (Optional) Location in storage bucket to save files
# If not set, the default location will be the root of the storage bucket
bucketRootPath: '/'
# (Optional) An API key is required to write to a storage bucket.
# If missing, GOOGLE_APPLICATION_CREDENTIALS environment variable will be used.
# https://cloud.google.com/docs/authentication/production
@@ -75,6 +79,10 @@ techdocs:
# (Required) AWS S3 Bucket Name
bucketName: 'techdocs-storage'
# (Optional) Location in storage bucket to save files
# If not set, the default location will be the root of the storage bucket
bucketRootPath: '/'
# (Optional) An API key is required to write to a storage bucket.
# If not set, environment variables or aws config file will be used to authenticate.
# https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/loading-node-credentials-environment.html