feat(nodectl): notice add/list/revoke 子命令(校验+审计+可选邮件)

This commit is contained in:
wangjia
2026-07-13 14:01:50 +08:00
parent 75ec361542
commit 84b162e834
3 changed files with 417 additions and 1 deletions
+10 -1
View File
@@ -67,9 +67,16 @@ nodectl — elastic-node control plane CLI
nodectl rotate-pool -pool=consumable|premium [-concurrency=1]
nodectl providers [-pool=consumable|premium]
nodectl bootstrap-token -node=UUID
nodectl notice add -type=<important|feature|news|reward|version|promo>
-title-zh=... -title-en=... [-body-zh=...] [-body-en=...]
[-link=...] [-expires=YYYY-MM-DD] [-email]
nodectl notice list [-all] [-limit=20]
nodectl notice revoke <id>
Config via env: DB_DSN, REDIS_ADDR, REDIS_PASSWORD, PROVISION_CONTROL_PLANE_URL,
PROVISION_CLOUD_INIT_TMPL, PROVISION_<VENDOR>_* credentials.`))
PROVISION_CLOUD_INIT_TMPL, PROVISION_<VENDOR>_* credentials,
SMTP_HOST/SMTP_PORT/SMTP_USERNAME/SMTP_PASSWORD/SMTP_FROM
(notice add -email; unset = -email rejected with an error).`))
}
func buildService(ctx context.Context) (*provision.Service, func(), error) {
@@ -118,6 +125,8 @@ func run(ctx context.Context, cmd string, args []string) error {
return cmdProviders(ctx, args)
case "bootstrap-token":
return cmdBootstrapToken(ctx, args)
case "notice":
return cmdNotice(ctx, args)
case "-h", "--help", "help":
usage()
return nil