Nodejs Ghost 0.5.2 with Upyun Support 发布

Nodejs Ghost 0.5.2 with Upyun Support 发布

之前做又拍云支持的 GhostChina 一直没看到对于 0.5.x 的又拍云支持,所以自己做了一个,已经跑在了生产环境上。

https://github.com/sanddudu/ghost-0.5.2-upyun

有任何 bug 请及时提交 issue ,并且说明相关环境

2 回复

Nodejs Ghost 0.5.2 with Upyun Support 发布

之前做又拍云(Upyun)支持的 GhostChina 一直没看到对于 0.5.x 的又拍云支持,所以自己动手做了一个。该版本已经在生产环境中运行稳定。

你可以通过以下链接获取最新的代码:

如何使用

首先,确保你已经安装了 Node.js 和 Ghost。然后,你可以通过以下步骤将 Ghost 配置为使用又拍云存储:

  1. 克隆仓库

    git clone https://github.com/sanddudu/ghost-0.5.2-upyun.git
    cd ghost-0.5.2-upyun
    
  2. 安装依赖

    npm install
    
  3. 配置 Ghost: 打开 config.js 文件,找到 storage 部分,并将其配置为使用又拍云。示例如下:

    storage: {
        active: 'upyun',
        upyun: {
            bucket: 'your-bucket-name',
            operator: 'your-operator-name',
            password: 'your-password'
        }
    }
    
  4. 启动 Ghost

    npm start
    

示例代码

以下是一个完整的示例,展示了如何在 Ghost 中配置又拍云存储:

module.exports = function (config) {
    config.get('storage').active = 'upyun';
    config.set('storage.upyun', {
        bucket: 'your-bucket-name',
        operator: 'your-operator-name',
        password: 'your-password'
    });
    return config;
};

注意事项

  • 确保你已经注册了又拍云账号并创建了存储空间。
  • 在生产环境中,建议使用 pm2 来管理 Ghost 进程,以确保高可用性和稳定性。
  • 如果你在使用过程中遇到任何问题,请及时提交 issue,并详细描述你的环境信息。

希望这个版本能够帮助更多的人方便地使用又拍云存储来托管他们的 Ghost 博客。


Nodejs Ghost 0.5.2 with Upyun Support 发布

我们很高兴地宣布,经过一段时间的努力,为 Ghost 0.5.2 版本添加了对又拍云(Upyun)的支持。之前发现 GhostChina 对于 0.5.x 版本尚未提供对又拍云的支持,因此我们决定自己动手制作一个插件。目前该插件已经在生产环境中稳定运行。

如何使用

您可以从 GitHub 上克隆我们的仓库,并根据文档进行配置。以下是基本的步骤:

  1. 克隆仓库

    git clone https://github.com/sanddudu/ghost-0.5.2-upyun.git
    
  2. 安装依赖

    进入项目目录并安装所需的依赖包:

    cd ghost-0.5.2-upyun
    npm install
    
  3. 配置 Ghost

    在 Ghost 配置文件 config.js 中添加以下配置项:

    module.exports = {
        production: {
            storage: {
                active: 'upyun',
                upyun: {
                    bucket: 'your-bucket-name',
                    operator: 'your-operator-name',
                    password: 'your-password',
                    domain: 'your-cdn-domain'
                }
            }
        },
        // 其他配置项
    };
    
  4. 启动 Ghost

    使用以下命令启动 Ghost:

    node index.js
    

示例代码

为了更好地理解如何使用插件,下面提供一个简单的示例代码片段,用于上传图片到又拍云存储:

const GhostUpyunStorage = require('ghost-upyun-storage');
const upyunConfig = {
    bucket: 'your-bucket-name',
    operator: 'your-operator-name',
    password: 'your-password',
    domain: 'your-cdn-domain'
};

const storage = new GhostUpyunStorage(upyunConfig);
storage.uploadFile('/path/to/local/file', 'path/in/upyun')
    .then(result => console.log(`File uploaded successfully: ${result.url}`))
    .catch(err => console.error('Error uploading file:', err));

请注意,你需要将上述代码中的配置参数替换为你自己的实际信息。

提交问题

如果你在使用过程中遇到任何问题,请及时提交 Issue,并说明你的环境信息。我们会尽快处理并修复问题。

GitHub 地址:https://github.com/sanddudu/ghost-0.5.2-upyun

感谢你的支持和反馈!


希望这些信息对你有所帮助!

回到顶部