docs: 添加环境变量
Some checks failed
Deploy to Cloudflare / Check for Cloudflare Credentials (push) Has been cancelled
Deploy to Cloudflare / Deploy (push) Has been cancelled

This commit is contained in:
oiov 2025-10-29 15:06:17 +08:00
parent 8122f7d4d4
commit 00a6d4e7fd
8 changed files with 303 additions and 283 deletions

View File

@ -31,7 +31,7 @@
### 自动部署 (推荐)
本项目已包含一个预先配置好的 GitHub Action 工作流,可以帮助您自动将 vMail 应用部署到 Cloudflare。
本项目已包含一个预先配置好的 GitHub Action 工作流,可以帮助您自动将 Vmail 应用部署到 Cloudflare。
详细步骤请参考 [GitHub Action 自动部署教程](/docs/github-action-tutorial.md)。
@ -63,6 +63,16 @@
5. **配置电子邮件路由**
在您的 Cloudflare 域名管理界面,进入 `Email` -> `Email Routing` -> `Routes`,设置一个 `Catch-all` 规则,将所有发送到您域名的邮件 `Send to a Worker`,选择您刚刚部署的 Worker。
### 环境变量
在部署到 Cloudflare Pages 时,您需要配置以下环境变量:
- `DATABASE_NAME`: 您的 D1 数据库名称。
- `DATABASE_ID`: 您的 D1 数据库 ID。
- `TURNSTILE_KEY`: 您的 Turnstile 站点密钥。
- `TURNSTILE_SECRET`: 您的 Turnstile 密钥。
- `COOKIES_SECRET`: 用于签名 Cookie 的密钥。
## 🔨 本地运行调试
1. **复制环境变量文件**

View File

@ -32,7 +32,7 @@ This project is now fully based on Cloudflare Pages and Cloudflare D1, which gre
### Automatic Deployment (Recommended)
This project includes a pre-configured GitHub Action workflow to help you automatically deploy the vMail application to Cloudflare.
This project includes a pre-configured GitHub Action workflow to help you automatically deploy the Vmail application to Cloudflare.
For detailed steps, please refer to the [GitHub Action Auto-Deployment Tutorial](/docs/github-action-tutorial.md).
@ -82,6 +82,16 @@ For detailed steps, please refer to the [GitHub Action Auto-Deployment Tutorial]
This command starts both the frontend Vite development server and the local Wrangler Worker environment at the same time.
### Environment Variables
When deploying to Cloudflare Pages, you need to configure the following environment variables:
- `DATABASE_NAME`: Your D1 database name.
- `DATABASE_ID`: Your D1 database ID.
- `TURNSTILE_KEY`: Your Turnstile site key.
- `TURNSTILE_SECRET`: Your Turnstile secret key.
- `COOKIES_SECRET`: A secret used to sign cookies.
## Community Group
- Discord: https://discord.gg/d68kWCBDEs

View File

@ -1,6 +1,6 @@
# GitHub Action 自动部署教程
本项目已包含一个预先配置好的 GitHub Action 工作流文件 (`.github/workflows/deploy.yml`),可以帮助您自动将 vMail 应用部署到 Cloudflare Workers。
本项目已包含一个预先配置好的 GitHub Action 工作流文件 (`.github/workflows/deploy.yml`),可以帮助您自动将 Vmail 应用部署到 Cloudflare Workers。
## 准备工作
@ -12,16 +12,16 @@
前往您的 GitHub 仓库页面,点击 `Settings` -> `Secrets and variables` -> `Actions`,然后添加以下 `Repository secrets`
| Secret Name | 说明 | 示例值 |
| :----------------- | :------------------------------------------------------------------------------------------------- | :--------------------------------- |
| `CF_API_TOKEN` | Cloudflare API Token用于授权 Wrangler 操作。请确保该 Token 具有编辑 Workers 和 D1 数据库的权限。 | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
| `CF_ACCOUNT_ID` | 您的 Cloudflare 账户 ID可以在 Cloudflare 控制台主页的右侧找到。 | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
| Secret Name | 说明 | 示例值 |
| :----------------- | :------------------------------------------------------------------------------------------------- | :------------------------------------- |
| `CF_API_TOKEN` | Cloudflare API Token用于授权 Wrangler 操作。请确保该 Token 具有编辑 Workers 和 D1 数据库的权限。 | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
| `CF_ACCOUNT_ID` | 您的 Cloudflare 账户 ID可以在 Cloudflare 控制台主页的右侧找到。 | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
| `D1_DATABASE_ID` | 您的 D1 数据库 ID。 | `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |
| `D1_DATABASE_NAME` | 您的 D1 数据库名称。 | `vmail` |
| `EMAIL_DOMAIN` | 您的邮箱域名,如果多个域名请用逗号隔开。 | `vmail.dev,example.com` |
| `COOKIES_SECRET` | 用于加密 Cookie 的密钥,请设置为一个随机且足够复杂的字符串。 | `a-very-strong-and-random-secret` |
| `TURNSTILE_KEY` | Cloudflare Turnstile 网站密钥 (Site Key)。 | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
| `TURNSTILE_SECRET` | Cloudflare Turnstile 密钥 (Secret Key)。 | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
| `D1_DATABASE_NAME` | 您的 D1 数据库名称。 | `vmail` |
| `EMAIL_DOMAIN` | 您的邮箱域名,如果多个域名请用逗号隔开。 | `vmail.dev,example.com` |
| `COOKIES_SECRET` | 用于加密 Cookie 的密钥,请设置为一个随机且足够复杂的字符串。 | `a-very-strong-and-random-secret` |
| `TURNSTILE_KEY` | Cloudflare Turnstile 网站密钥 (Site Key)。 | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
| `TURNSTILE_SECRET` | Cloudflare Turnstile 密钥 (Secret Key)。 | `xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` |
## 触发自动部署

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,14 @@
<!DOCTYPE html>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>vMail - 临时邮箱</title>
<script type="module" crossorigin src="/assets/main-C4MSjDq3.js"></script>
<title>Vmail - 临时邮箱</title>
<script type="module" crossorigin src="/assets/main-Cj20Dz1y.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-B3RYd5Io.css">
</head>
<body>
<div id="root"></div>
</body>
</html>
</html>

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>vMail - 临时邮箱</title>
<title>Vmail - 临时邮箱</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
</html>