Announcing our new Vercel integration

Using environment variables

Use .env files to populate environment variables for local testing.

npx inngest-cli init --template github.com/inngest/inngest#examples/simple-env-vars
See more quickstarts
Explore the code

A simple example of parsing and returning environment variables when running locally via inngest run in a few different languages.

graph LR Source[Your app] -->|"demo/event.sent"| Inngest(Inngest) Inngest -->Golang(steps/golang) Inngest -->|Triggers| Python(steps/python) Inngest -->TypeScript(steps/typescript) classDef in fill:#4636f5,color:white,stroke:#4636f5; classDef inngest fill:white,color:black,stroke:#4636f5,stroke-width:3px; classDef out fill:white,color:black,stroke:#4636f5,stroke-dasharray: 5 5,stroke-width:3px; class Source in; class Inngest,Golang,Python,TypeScript inngest; class Output out;

Contents

Usage

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

Configuration

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"
        }
      ]
    }
  }
}

Code

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.

More quickstarts

See all quickstarts