Skip to content

feat(storage): add Google Cloud Storage module - #8061

Open
horusglez wants to merge 1 commit into
requarks:mainfrom
horusglez:feature/gcs-storage-module
Open

feat(storage): add Google Cloud Storage module#8061
horusglez wants to merge 1 commit into
requarks:mainfrom
horusglez:feature/gcs-storage-module

Conversation

@horusglez

Copy link
Copy Markdown

Summary

Adds a push-mode storage target module for Google Cloud Storage. Wiki.js core currently ships storage targets for Azure, S3, Dropbox, Box, Google Drive, OneDrive, DigitalOcean Spaces, SFTP, Git and local disk, but not GCS directly.

Follows the same interface as the existing disk/s3 modules: created, updated, deleted, renamed, assetUploaded, assetDeleted, assetRenamed, plus an exportAll action (mirrors disk's dump) to bulk-push existing content.

Config

  • Bucket Name
  • Project ID
  • Service Account Key (JSON)
  • Make Uploaded Files Public (optional)

The bucket must already exist; the module validates access via bucket.exists() on init but does not create the bucket.

Required service account roles (on the bucket, not project-wide): Storage Object Admin (object CRUD) + Storage Legacy Bucket Reader (needed for storage.buckets.get, used by the init check — Storage Object Admin alone does not include this permission).

Test plan

  • Unit tests added in server/test/modules/storage/gcs/storage.test.js covering init (valid/invalid JSON key, missing/inaccessible bucket, projectId fallback to the key's project_id), file path resolution including locale namespacing, and all create/update/delete/rename/asset handlers, with @google-cloud/storage mocked.
  • Manually validated against a real GCS bucket: module loads (Loaded 1 new storage targets: OK), init succeeds against a real bucket with the two roles above, page create/update/delete correctly reflected in the bucket, confirmed visually in the GCS console.

🤖 Built with Claude Code

Adds a push-mode storage target for Google Cloud Storage, following
the same interface as the existing disk/s3 modules (created, updated,
deleted, renamed, assetUploaded, assetDeleted, assetRenamed, plus an
Export All action).

Config: bucket name, project ID, service account key (JSON), and an
optional toggle to make uploaded files public.

Service account needs 2 roles on the bucket: Storage Object Admin
(object CRUD) and Storage Legacy Bucket Reader (storage.buckets.get,
used by the bucket-existence check on init).

Includes unit tests covering init (valid/invalid credentials, missing
bucket), file path resolution (including locale namespacing), and all
create/update/delete/rename/asset handlers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant