diff --git a/index.d.ts b/index.d.ts index af1fb8a..04f1e05 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1103,6 +1103,23 @@ declare global { * */ project(): ProjectInfo + /** + * Read a project secret from `secrets:` in the project config. + * + * Secrets are never part of `project()`, a project API response or any + * other JSON projection — hooks and actions only. Values are substituted + * from `config.yml.env` like every other `${VAR}`. + * + * @param name secret name + * @returns the value, or `null` when no such secret is configured + */ + secret(name: string): string | null + + /** + * Names of the configured project secrets (sorted). Values are never + * included — this is for diagnostics and setup screens. + */ + secretNames(): string[] /** * get server config object (sensitive fields like jwtSecret, adminTokens, apiKeys are excluded) diff --git a/schemas/config/project.schema.json b/schemas/config/project.schema.json index 519d91b..4951d7c 100644 --- a/schemas/config/project.schema.json +++ b/schemas/config/project.schema.json @@ -12,6 +12,13 @@ "type": "string", "pattern": "^[A-Za-z0-9_-]+$" }, + "secrets": { + "description": "Values for hooks/actions only (JWT keys, SMTP passwords, ...). Substituted from config.yml.env like every other value; never part of a project API response or context.config.project(). Read them with context.config.secret(name).", + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "meta": { "type": "object", "additionalProperties": false,