The proper place to store secrets, keys, and API tokens is in
Environment Variables. When you add a key and value to
the list of environment variables on that page, it becomes available via the
Environment variables can be accessed via
This uses the Deno-default Deno.env variable, which is available globally.
This is the conventional way to access environment variables when you’re in a Node.js environment. In Node.js, process is an always-available global variable, but since Val Town targets Deno, you’ll need to import process from node:process:
- Vals can’t set environment variables: Environment variables are set via the settings page. Trying to update an environment variable, for example by using
Deno.env.set, is a no-op.