Environment Variables
Read environment variables exposed to the sandbox via the run config.
import type { ExportedHandler } from "kyushu-types";
export default { async fetch() { const apiKey = process.env.API_KEY ?? "not set";
return { status: 200, headers: { "content-type": "application/json" }, body: JSON.stringify({ API_KEY: apiKey }), }; },} satisfies ExportedHandler;Config
Section titled “Config”By default, the sandbox has no access to the host environment. Explicitly expose variables to make them available to your worker.
[[env]]key = "API_KEY"value = "secret"Try it
Build and run the worker with its config.
kyu build && kyu run kyushu.run.tomlThen send a request to test it.
curl http://localhost:5987