Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
jetsung committed Jan 4, 2024
1 parent 1e771df commit b762842
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- 2.1b 通过命令行创建:`wrangler kv:namespace create datastore`
3. `KV` 设置 `别名值`,Key 为别名(单词),Value(目标网址,含 `http(s)://`)。

4. 最终访问域名地址组合为:
4. 最终访问域名地址组合为(案例)
> https://wcdn.kkgo.cc/github.com/servless/worker-cdn > https://wcdn.kkgo.cc/github/servless/worker-cdn (别名)
> https://wcdn.kkgo.cc/rawgh/servless/worker-cdn/main/README.md[别名](https://raw.githubusercontent.com/servless/worker-cdn/main/README.md)
Expand All @@ -30,11 +30,8 @@

```bash
# 登录,可能登录不成功
wrangler login

# 若登录不成功,可能需要使用代理。
# 每个命令行前,均需要加 HTTP_PROXY=http://localhost:20171
HTTP_PROXY=http://localhost:20171 wrangler login
wrangler login
```

4. 拉取本项目:
Expand All @@ -43,13 +40,19 @@
git clone https://github.com/servless/worker-cdn.git
```

5. 修改 `wrangler.toml` 文件中的 `name`(cdn)为服务名 `xxx`(访问域名为:`cdn.xxx.workers.dev`),修改 `WEB_URL` 为需要加速的网站网址。
**注:** 后期可以通过 Cloudflare 官网的 Workers 服务设置环境变量。重新推送当前代码时,会将线上的 `WEB_URL` 覆盖。
5. 修改 `wrangler.toml` 文件中的 `name`(cdn)为服务名 `xxx`(访问域名为:`cdn.xxx.workers.dev`)。

6. 可选)。通过命令行创建,`KV`,并设置 `别名值`,Key 为别名(单词),Value(目标网址,含 `http(s)://`)。

```bash
wrangler kv:namespace create datastore
wrangler kv:key put --binding=datastore 'github' 'https://github.com'
```

6. 发布
7. 发布

```bash
HTTP_PROXY=http://localhost:20171 wrangler publish
wrangler publish
```

发布成功将会显示对应的网址
Expand All @@ -67,7 +70,7 @@
**由于某些原因,`workers.dev` 可能无法正常访问,建议绑定自有域名。**
7. 绑定域名
8. 绑定域名
在 Cloudflare Workers 的管理界面中,点击 `Triggers` 选项卡,然后点击 `Custom Domians` 中的 `Add Custom Domain` 按钮以绑定域名。
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
"scripts": {
"deploy": "wrangler publish src/index.ts",
"dev": "wrangler dev src/index.ts --local",
"publish": "HTTP_PROXY=http://localhost:20171 wrangler publish",
"publish": "wrangler publish",
"start-stackblitz": "WRANGLER_SEND_METRICS=false wrangler dev src/index.ts --local",
"test": "vitest"
},
"devDependencies": {
"@cloudflare/workers-types": "^3.0.0",
"vitest": "^0.24.5",
"wrangler": "^2.1.14"
"vitest": "^0.24.5"
}
}

0 comments on commit b762842

Please sign in to comment.