WriteSecret
Source:
src/Fly/WriteSecret.ts
Create, update, and delete Fly.io App secrets at runtime.
The App is fixed by WriteSecret(secret). Calls take no
app_name. Inside a Machine or Service, Alchemy
mints an App deploy token. Inside an Action, the ambient
FLY_API_TOKEN is used.
Create
Section titled “Create”Bind the client in init. Provide WriteSecretHttp. Wrap
values with Redacted.make.
const Seed = Alchemy.Action( "Seed", Effect.gen(function* () { const secrets = yield* Fly.WriteSecret(ApiToken);
return Effect.fn(function* () { yield* secrets.create("API_KEY", Redacted.make("sk_live")); }); }).pipe(Effect.provide(Fly.WriteSecretHttp)),);Update
Section titled “Update”update rotates by name (batch of one).
yield* secrets.update("API_KEY", Redacted.make("sk_live_rotated"));Delete
Section titled “Delete”delete removes a secret by name.
yield* secrets.delete("API_KEY");