GithubHelp home page GithubHelp logo

ghost-alicloud-store's Introduction

Ghost AliCloud OSS Storage

This Ghost custom storage module allows you to store media file at AlibabaCloud OSS instead of storing at local machine. It requires Ghost greater than 2.x!

Installation

Via NPM

  • Install AliCloud storage module

    npm install ghost-alicloud-store
    
  • Make the storage folder if it doesn't exist yet

    mkdir content/adapters/storage
    
  • Copy the module into the right location

    cp -vR node_modules/ghost-alicloud-store content/adapters/storage/alicloud-store
    

    Or create a file named alicloud-store.js with below content:

    //  content/adapters/storage/alicloud-store.js
    module.exports = require('ghost-alicloud-store');
    

Via Git

In order to replace the storage module, the basic requirements are:

  • Create a new folder inside /content/adapters called /storage

  • Clone this repo to /storage

    cd [path/to/ghost]/content/adapters/storage
    git clone https://github.com/Minwe/ghost-alicloud-store.git alicloud-store
    
  • Install dependencies

    cd alicloud-store
    npm install
    

Configuration

In your config.[env].json file, you'll need to add a new storage block to whichever environment you want to change:

storage: {
  active: 'alicloud-store',
  'alicloud-store': {
    // see @https://help.aliyun.com/document_detail/64097.html
    accessKeyId: 'your access key',
    accessKeySecret: 'your access secret',
    bucket: 'your bucket name',
    region: 'oss-cn-hangzhou',
    endpoint: "",
    cname: "",

    // file storage key config [optional]
    fileKey: {
      safeString: true, // use Ghost safaString util to rename filename, e.g. Chinese to Pinyin
      prefix: 'YYYY/MM/', // {String} will be formated by moment.js, using `[]` to escape,
      suffix: '', // {String} string added before file extname.
      extname: true // keep file's extname
    }
    // take `外面的世界 x.jpg` as example,
    // applied above options, you will get an URL like below after uploaded:
    //  http://${bucket}.${origin}.aliyuncs.com/2016/06/wai-mian-de-shi-jie-x.jpg
  }
}

License

Read LICENSE

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.