Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Environment Variables

Any number of environment variables can be defined in the schema, which will be placed in the Wrangler configuration and made available to the Worker at runtime.

Defining Environment Variables

Note

Variables are restricted to the same set of primitive types as SQLite Types.

To define an environment variable, use the var block in the schema:

var {
    MY_VAR: string
    MY_OTHER_VAR: int
}

Inject them into an API endpoint like so:

api Foo  {
    get bar -> string {
        inject { MY_VAR }
    }
}