feat: implement dfguide-registrar project with Postgres user registration functionality

This commit is contained in:
siujamo
2026-04-30 16:39:10 +08:00
commit 449cab6c06
9 changed files with 2633 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
# dfguide-registrar
一个交互式 Rust CLI,用于向 [Delta Force Guide] 的 Postgres 数据库写入注册用户。
## 功能
-`.env` 文件或系统环境变量读取 Postgres 连接信息
- 交互式输入用户名、电子邮箱、密码
-`provider = LOCAL` 时,使用 Spring Security 兼容的 BCrypt 哈希保存密码
- 以单个数据库事务写入 `app_user``app_user_credential`
- 在写入前检查用户名和邮箱是否已存在
## 环境变量
支持两种配置方式:
1. 设置完整连接串 `PG_URL`
2. 或分别设置以下变量:
- `PG_HOST`
- `PG_PORT`(可选,默认 `5432`
- `PG_USER`
- `PG_PASSWORD`
- `PG_DATABASE`
可以复制 `.env.example``.env` 后修改:
```powershell
Copy-Item .env.example .env
```
## 运行
```powershell
cargo run
```
程序会按顺序提示输入用户名、邮箱和密码。
## 测试
```powershell
cargo test
```
[Delta Force Guide]:https://dfguide.onixbyte.cn/