Skip to content

Secret

Source: src/Cloudflare/SecretsStore/Secret.ts

A single secret stored inside a Cloudflare Secrets Store.

The secret value is treated as redacted and is only ever sent to Cloudflare at create time. Updating scopes or comment issues a PATCH; changing value or name replaces the secret.

const store = yield* Cloudflare.SecretsStore("MyStore");
const apiKey = yield* Cloudflare.StoreSecret("ApiKey", {
store,
value: Redacted.make(process.env.API_KEY!),
});
const apiKey = yield* Cloudflare.StoreSecret.bind(ApiKey);
// `apiKey` is itself an Effect that resolves to the secret value:
const value = yield* apiKey;
// Or call `.get()` explicitly:
const value = yield* apiKey.get();