开发者社区> 问答> 正文

寻找OSS好应用系列之ghost-oss-store

名称:ghost-oss-store
环境:Node.js
作者:MT-Libraries(小组)
Github:https://github.com/MT-Libraries/ghost-oss-store
简介 如其名,该插件为 Node.js 环境下知名博客程序 Ghost 自定义存储插件,为阿里云 对象存储 OSS 适配制作的数据存储插件。

该Ghost自定义存储模块允许您将媒体文件与Aliyun OSS存储在一起,而不是存储在本地机器上。


支持的Ghost版本


1.X
0.X



安装




Via NPM


安装Oss存储模块


npm install ghost-oss-store

如果尚不存在存储文件夹


mkdir content/storage

将模块复制到正确的位置


cp -vR node_modules/ghost-oss-store content/storage/oss-store

Via Git


为了更换存储模块,基本要求是:


在 /content 文件夹下新建一个名为 /storage 的文件夹


通过Git拉取项目文件至 /storage



cd [path/to/ghost]/content/storage
mkdir oss-store && cd oss-store
git clone https://github.com/MT-Libraries/ghost-oss-store ./


安装依赖关系


npm install

Configuration



在您的config.js文件中,您需要为storage要更改的环境添加新的块:

storage: {
  active: 'oss-store',
  'oss_store': {
    accessKeyId: 'accessKeyId',
    accessKeySecret: 'accessKeySecret',
    bucket: 'bucket',
    region: 'oss-cn-hangzhou',
    origin: 'https://www.thonatos.com/', // if you have bind custom domain to oss bucket. or false            
    fileKey: {
      safeString: true, // use Ghost safaString util to rename filename, e.g. Chinese to Pinyin
      prefix: 'ghost/',  // { String } will be formated by moment.js, using `[]` to escape,
      suffix: '' // { String } string added before file extname.
    }
  }
}


展开
收起
寒喵 2017-10-24 23:12:02 4368 0
0 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
OSS运维进阶实战手册 立即下载
《OSS运维基础实战手册》 立即下载
OSS运维基础实战手册 立即下载