mirror of
https://github.com/MarSeventh/CloudFlare-ImgBed.git
synced 2026-02-01 22:47:37 +00:00
服务器部署支持模拟CloudflareR2存储
This commit is contained in:
14
README.md
14
README.md
@@ -203,7 +203,7 @@
|
||||
|
||||
2. 切换到项目根目录,运行`npm install`,安装所需依赖。
|
||||
|
||||
3. 在项目根目录下新建`wrangler.toml`配置文件,其内容为项目名称,环境变量(**包括`TG_BOT_TOKEN`和`TG_CHAT_ID`等必填参数**)等,可根据后文环境变量配置进行个性化修改。(详情参见官方文档[Configuration - Wrangler (cloudflare.com)](https://developers.cloudflare.com/workers/wrangler/configuration/))
|
||||
3. 在项目根目录下新建`wrangler.toml`配置文件,其内容为项目名称,环境变量(**包括`TG_BOT_TOKEN`和`TG_CHAT_ID`等参数**)等,可根据后文环境变量配置进行个性化修改。(详情参见官方文档[Configuration - Wrangler (cloudflare.com)](https://developers.cloudflare.com/workers/wrangler/configuration/))
|
||||
|
||||
> 配置文件样例:
|
||||
>
|
||||
@@ -220,11 +220,17 @@
|
||||
> TG_CHAT_ID = "your_bot_id"
|
||||
> ```
|
||||
|
||||
4. 在项目根目录下运行`npm run start`,至此,正常情况下项目已经成功部署。
|
||||
4. 在项目根目录下运行`npm run start`,至此,正常情况下项目已经成功部署。项目默认支持通过服务器**本地模拟的R2存储上传**。
|
||||
|
||||
程序默认运行在`8080`端口上,使用`nginx`等服务器反代`127.0.0.1:8080`即可外网访问服务。如需修改端口,可在`package.json`中修改`start`脚本的`port`参数(如下图)。
|
||||
程序默认运行在`8080`端口上,使用`nginx`等服务器反代`127.0.0.1:8080`即可外网访问服务。如需修改端口,可在`package.json`中修改`start`脚本的`port`参数(如下)。
|
||||
|
||||

|
||||
```toml
|
||||
"scripts": {
|
||||
"ci-test": "concurrently --kill-others \"npm start\" \"wait-on http://localhost:8080 && mocha\"",
|
||||
"test": "mocha",
|
||||
"start": "npx wrangler pages dev ./ --kv \"img_url\" --r2 \"img_r2\" --port 8080 --persist-to ./data"
|
||||
}
|
||||
```
|
||||
|
||||
正常启动,控制台输出如下:
|
||||
|
||||
|
||||
@@ -2,16 +2,17 @@
|
||||
"scripts": {
|
||||
"ci-test": "concurrently --kill-others \"npm start\" \"wait-on http://localhost:8080 && mocha\"",
|
||||
"test": "mocha",
|
||||
"start": "npx wrangler pages dev ./ --kv \"img_url\" --port 8080 --persist-to ./data"
|
||||
"start": "npx wrangler pages dev ./ --kv \"img_url\" --r2 \"img_r2\" --port 8080 --persist-to ./data"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cloudflare/pages-plugin-sentry": "^1.1.3",
|
||||
"@sentry/tracing": "^7.114.0"
|
||||
"@sentry/tracing": "^7.114.0",
|
||||
"miniflare": "^3.20240718.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"concurrently": "^8.2.2",
|
||||
"mocha": "^10.6.0",
|
||||
"wait-on": "^7.2.0",
|
||||
"wrangler": "^3.63.0"
|
||||
"wrangler": "^3.66.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user