feat(tenant): optional legacy auto-create API key on tenant creation
Add a tenant.auto_create_api_key setting (env WEKNORA_TENANT_AUTO_CREATE_API_KEY, default false) that restores the pre-break-change behaviour of minting a full_access API key when a tenant is created and returning its plaintext token in the create response (data.api_key). - system_setting: register tenant.auto_create_api_key bool spec - handler: gate auto key creation behind the setting; embed the token via tenantWithAPIKey without re-adding a persisted api_key column; key-creation failures log a warning and do not fail tenant creation - client: add optional Tenant.APIKey field populated only on create - docs/env: document the switch (.env.example, docker-compose, tenant.md, regenerated swagger)
This commit is contained in:
@@ -166,6 +166,23 @@ var registry = map[string]settingSpec{
|
||||
"仅在创建时读取,修改后只对之后新建的租户生效,不会回写已存在的租户。" +
|
||||
"0 或负数表示使用内置默认值 10GB。",
|
||||
},
|
||||
// tenant.auto_create_api_key restores the legacy behaviour where creating
|
||||
// a tenant also minted a full-access API key and returned its plaintext
|
||||
// token in the create response. Newer versions stopped doing this (keys
|
||||
// are created explicitly via tenant_api_keys), which is a breaking change
|
||||
// for integrations that relied on the create response carrying a key.
|
||||
// Deployments that need the old behaviour set this to true (or the
|
||||
// WEKNORA_TENANT_AUTO_CREATE_API_KEY env var). Default false keeps the
|
||||
// current, safer no-implicit-key behaviour. Read at create time only.
|
||||
"tenant.auto_create_api_key": {
|
||||
Type: "bool",
|
||||
EnvName: "WEKNORA_TENANT_AUTO_CREATE_API_KEY",
|
||||
Default: false,
|
||||
Category: "tenant",
|
||||
Description: "创建租户时是否自动生成一个全量权限(full_access)的 API Key,并在创建接口的响应中返回其明文 token。" +
|
||||
"用于兼容旧版本「创建租户即下发默认 API Key」的行为(属于破坏性变更的回退开关)。" +
|
||||
"每次创建租户时实时读取,修改后立即生效。默认 false(不自动创建,需通过 API Key 管理显式创建)。",
|
||||
},
|
||||
// asynq.concurrency is the asynq worker pool size (parallel in-flight
|
||||
// tasks). Read once when the asynq server starts — changing it in the
|
||||
// UI requires a process restart to take effect. Mirrors
|
||||
|
||||
Reference in New Issue
Block a user