Use .env files to populate environment variables for local testing.
npx inngest-cli init --template github.com/inngest/inngest#examples/simple-env-vars
A simple example of parsing and returning environment variables when running locally via inngest run
in a few different languages.
Use this quickstart with a single CLI command to get started! The CLI will then guide you through running, testing, and deploying to Inngest Cloud.
npx inngest-cli init --template github.com/inngest/inngest#examples/simple-env-vars
# or
inngest init --template github.com/inngest/inngest#examples/simple-env-vars
Next, just run your function locally to see how it consumes and returns the local .env
file!
npx inngest-cli run
# or
inngest run
Below is the annotated function definition (found at inngest.json) to show how the above is defined in config.
{
"name": "simple-env-vars",
"id": "direct-narwhal-196e41",
"triggers": [
{
"event": "demo/event.sent",
"definition": {
"format": "cue",
"synced": true,
"def": "file://./events/demo-event-sent.cue"
}
}
],
"steps": {
/**
* Our Golang example
*/
"golang": {
"id": "golang",
"path": "file://steps/golang",
"name": "golang",
"runtime": {
"type": "docker"
}
},
/**
* Our Python example
*/
"python": {
"id": "python",
"path": "file://steps/python",
"name": "python",
"runtime": {
"type": "docker"
},
"after": [
{
"step": "$trigger"
}
]
},
/**
* Our TypeScript example
*/
"typescript": {
"id": "typescript",
"path": "file://steps/typescript",
"name": "typescript",
"runtime": {
"type": "docker"
},
"after": [
{
"step": "$trigger"
}
]
}
}
}
This function shows using env vars in three different languages: Golang, Python, and TypeScript. There's a separate step for each, triggered by the initial event, demo/event.sent
.