Giter Club home page Giter Club logo

ghos3's Introduction

GhoS3

An AWS S3 storage adapter tested on Ghost 5.x.

This is a modernized version based on colinmeinke/ghost-storage-adapter-s3. Major changes are:

  • Adopted async/await
  • Rewritten in TypeScript
  • Use latest Version 3 of AWS SDK

It's designed to be a drop-in replacement of colinmeinke's package, so configuration and installation method remained largely the same.

However, this port pretty much targets only Ghost 5.x and up, as the build toolchain is set to target Node 16.x. With some modifications this should work for older version of Ghost (PRs welcomed).

On my blog The Base, I use Cloudflare R2 with GhoS3.

Installation

npm install ghos3
mkdir -p ./content/adapters/storage
cp -r ./node_modules/ghos3/* ./content/adapters/storage/s3

Configuration

Largely the same, but note signatureVersion and serverSideEncryption are removed since in AWS SDK v3 they're implemented differently than just a simple string field (PRs welcomed, of course).

"storage": {
  "active": "s3",
  "media":{
     "adapter": "s3"
  },
  "files": {
    "adapter": "s3"
  },
  "s3": {
    "accessKeyId": "YOUR_ACCESS_KEY_ID",
    "secretAccessKey": "YOUR_SECRET_ACCESS_KEY",
    "region": "YOUR_REGION_SLUG",
    "bucket": "YOUR_BUCKET_NAME",
    "assetHost": "YOUR_OPTIONAL_CDN_URL (See note 1 below)",
    "pathPrefix": "YOUR_OPTIONAL_BUCKET_SUBDIRECTORY",
    "endpoint": "YOUR_OPTIONAL_ENDPOINT_URL (only needed for 3rd party S3 providers)",
    "forcePathStyle": true,
    "acl": "YOUR_OPTIONAL_ACL (See note 3 below)",
  }
}

Notes

  1. Be sure to include // or the appropriate protocol within your assetHost string/variable to ensure that your site's domain is not prepended to the CDN URL.
  2. If your S3 provider requires path style, you can enable it with forcePathStyle.
  3. If you use CloudFront the object ACL does not need to be set to public-read.

Via environment variables

AWS_DEFAULT_REGION
AWS_ACCESS_KEY_ID // optional
AWS_SECRET_ACCESS_KEY // optional
GHOST_STORAGE_ADAPTER_S3_PATH_BUCKET
GHOST_STORAGE_ADAPTER_S3_ASSET_HOST  // optional
GHOST_STORAGE_ADAPTER_S3_PATH_PREFIX // optional
GHOST_STORAGE_ADAPTER_S3_ENDPOINT // optional
GHOST_STORAGE_ADAPTER_S3_FORCE_PATH_STYLE // optional
GHOST_STORAGE_ADAPTER_S3_ACL // optional

For configuration on the AWS side, colinmeinke's original README has a detailed tutorial to set your up.

License

ISC

ghos3's People

Contributors

laosb avatar adityapatadia avatar acvigue avatar jac1013 avatar outsideris avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.