mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-07-10 15:02:32 +08:00
feat: add UserLogin (#209)
This commit is contained in:
@@ -38,6 +38,8 @@ wrangler d1 execute dev --file=db/schema.sql
|
||||
# schema update, if you have initialized the database before this date, you can execute this command to update
|
||||
# wrangler d1 execute dev --file=db/2024-01-13-patch.sql
|
||||
# wrangler d1 execute dev --file=db/2024-04-03-patch.sql
|
||||
# create a namespace, and copy the output to wrangler.toml in the next step
|
||||
wrangler kv:namespace create DEV
|
||||
```
|
||||
|
||||

|
||||
@@ -99,6 +101,11 @@ binding = "DB"
|
||||
database_name = "xxx" # D1 database name
|
||||
database_id = "xxx" # D1 database ID
|
||||
|
||||
# kv config for send email verification code
|
||||
# [[kv_namespaces]]
|
||||
# binding = "KV"
|
||||
# id = "xxxx"
|
||||
|
||||
# Create a new address current limiting configuration
|
||||
# [[unsafe.bindings]]
|
||||
# name = "RATE_LIMITER"
|
||||
|
||||
BIN
vitepress-docs/docs/public/ui_install/worker-kv-bind.png
Normal file
BIN
vitepress-docs/docs/public/ui_install/worker-kv-bind.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
BIN
vitepress-docs/docs/public/ui_install/worker-kv.png
Normal file
BIN
vitepress-docs/docs/public/ui_install/worker-kv.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -5,9 +5,11 @@
|
||||
## 初始化数据库
|
||||
|
||||
```bash
|
||||
cd worker
|
||||
cp wrangler.toml.template wrangler.toml
|
||||
# 创建 D1 并执行 schema.sql
|
||||
wrangler d1 create dev
|
||||
wrangler d1 execute dev --file=db/schema.sql
|
||||
wrangler d1 execute dev --file=../db/schema.sql
|
||||
```
|
||||
|
||||
创建完成后,我们在 cloudflare 的控制台可以看到 D1 数据库
|
||||
@@ -22,6 +24,7 @@ wrangler d1 execute dev --file=db/schema.sql
|
||||
找到需要执行的 `patch` 文件, 执行, 例如:
|
||||
|
||||
```bash
|
||||
wrangler d1 execute dev --file=db/2024-01-13-patch.sql
|
||||
wrangler d1 execute dev --file=db/2024-04-03-patch.sql
|
||||
cd worker
|
||||
wrangler d1 execute dev --file=../db/2024-01-13-patch.sql
|
||||
wrangler d1 execute dev --file=../db/2024-04-03-patch.sql
|
||||
```
|
||||
|
||||
@@ -8,6 +8,17 @@ pnpm install
|
||||
cp wrangler.toml.template wrangler.toml
|
||||
```
|
||||
|
||||
## 创建 KV 缓存
|
||||
|
||||
> [!NOTE]
|
||||
> 如果你要启用注册用户功能,并需要发送邮件验证,则需要创建 `KV` 缓存, 不需要可跳过此步骤
|
||||
|
||||
通过命令行创建 KV 缓存,或者在 Cloudflare 控制台创建,然后复制对应配置到 `wrangler.toml` 文件中
|
||||
|
||||
```bash
|
||||
wrangler kv:namespace create DEV
|
||||
```
|
||||
|
||||
## 修改 `wrangler.toml` 配置文件
|
||||
|
||||
```toml
|
||||
@@ -58,6 +69,11 @@ binding = "DB"
|
||||
database_name = "xxx" # D1 数据库名称
|
||||
database_id = "xxx" # D1 数据库 ID
|
||||
|
||||
# kv config 用于用户注册发送邮件验证码,如果不启用用户注册或不启用注册验证,可以不配置
|
||||
# [[kv_namespaces]]
|
||||
# binding = "KV"
|
||||
# id = "xxxx"
|
||||
|
||||
# 新建地址限流配置 /api/new_address
|
||||
# [[unsafe.bindings]]
|
||||
# name = "RATE_LIMITER"
|
||||
|
||||
@@ -38,3 +38,10 @@
|
||||
7. 点击 `Settings` -> `Variables`, 下拉找到 `D1 Database`, 点击 `Add Binding`, 名称如图,选择刚刚创建的 D1 数据库,点击 `Deploy`
|
||||
|
||||

|
||||
|
||||
8. 如果你要启用注册用户功能,并需要发送邮件验证,则需要创建 `KV` 缓存, 不需要可跳过此步骤,点击 `Workers & Pages` -> `KV` -> `Create Namespace`, 如图,点击 `Create Namespace`,然后在 `Settings` -> `Variables`, 下拉找到 `KV`, 点击 `Add Binding`, 名称如图,选择刚刚创建的 `KV` 缓存,点击 `Deploy`
|
||||
> [!NOTE]
|
||||
> 如果你要启用注册用户功能,并需要发送邮件验证,则需要创建 `KV` 缓存, 不需要可跳过此步骤
|
||||
|
||||

|
||||

|
||||
|
||||
Reference in New Issue
Block a user