FastEdge::env
Environment Variables
Section titled “Environment Variables”To access environment variables, set during deployment on the FastEdge network.
import { getEnv } from 'fastedge::env';
async function eventHandler(event) { const customEnvVariable = getEnv('MY_CUSTOM_ENV_VAR'); return new Response({ customEnvVariable });}
addEventListener('fetch', (event) => { event.respondWith(eventHandler(event));});getEnv(keyName);Parameters
Section titled “Parameters”-
keyName(required)A string containing the name of the key you want to retrieve the value of.
Return Value
Section titled “Return Value”A string containing the value of the key. If the key does not exist, null is returned.