Skip to content
English

管理员注册 ​

FinClaw 通过 identity-service 的 POST /auth/register 创建用户;管理员权限由 .env 的 ADMIN_EMAILS 控制。

单机版 ​

bash
# 位置参数
./scripts/register-admin.sh admin@example.com <password>

# 环境变量方式
ADMIN_EMAIL=admin@example.com ADMIN_PASSWORD=xxx ./scripts/register-admin.sh

# 指定网关地址(默认 http://localhost:26100 或读取 .env)
./scripts/register-admin.sh --url https://your-domain.com

脚本随离线包提供,位于 deploy/scripts/ 目录。密码长度至少 8 位。注册成功后脚本会提示将邮箱加入 ADMIN_EMAILS 并执行 fleet.sh down && fleet.sh up -d 重启服务。

K8s 版本 ​

方式一:kubectl exec 进 Pod 执行 ​

bash
kubectl -n <ns> exec -it deploy/identity-service -- \
  ./scripts/register-admin.sh admin@example.com <password>

适用于镜像内已打包 scripts/register-admin.sh 的场景。若镜像内无此脚本,可改为方式二。

方式二:port-forward 后本地调用 ​

bash
kubectl -n <ns> port-forward svc/identity-service 26101:26101

# 另一终端
curl -X POST http://localhost:26101/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"admin@example.com","password":"<password>"}'

port-forward 将 identity-service 的 26101 端口映射到本地,绕过 api-gateway 直接调用。注册请求体与单机版一致:{email, password},返回 201 或 200 即成功。

生效说明 ​

  1. 确保目标邮箱已加入 ADMIN_EMAILS(逗号分隔)。
  2. 单机模式:修改 .env 后重启服务方可生效(./scripts/fleet.sh down && ./scripts/fleet.sh up -d)。
  3. K8s 模式:修改 ConfigMap 或 Helm values 后 helm upgrade + kubectl rollout restart deploy/identity-service。
  4. 多租户场景:管理员范围与租户隔离关系,管理员可跨租户操作。

详见 日常操作 - 配置热更新边界。

Digital Ecosystem Infrastructure.