Warning
You're browsing the documentation for an old version of Webiny. Consider upgrading your project to Webiny 5.41.x.
Can I use this?

This feature is available since Webiny v5.39.0.

What you’ll learn
  • how to inject new environment variables into the Admin app

Overview
anchor

Admin app relies on several environment variables that get injected into React apps at build time using Pulumi state files. Sometimes, you might want to inject new variables, relevant to your project, and in this article we show you how to do just that.

Note that the naming convention for environment variables is explained in a dedicated article on Environment Variables.

Inject Variables From Pulumi State
anchor

Admin app config modifier contains a utility called pulumiOutputToEnv, which helps you load the Pulumi state of a specific app (for example, core or api), and use it modify the existing set of environment variables.

apps/admin/webiny.config.ts

The ApiOutput is a type definition of all the Pulumi outputs that Webiny ships by default. This gives you proper autocomplete on the output object.

Inject Arbitrary Variables
anchor

Sometimes you will need to inject values that do not come from Pulumi, but from other sources, like .env file, or some other places you might have. In that case, use a customEnv method:

apps/admin/webiny.config.ts