Build settings and environment variables
Builder Code
When you publish with Builder Cloud, Builder builds your Project using the settings in your Project's builder.config.json file. Use the Project's hosting settings to override how the site is built and to provide environment variables at build time or at runtime.
Open build settings
- Open your Project and go to Project settings.
- Select the Hosting tab.
- Expand Advanced Settings.
Settings here override builder.config.json when you publish. Leave a field blank to use the value from your config file or the default.
Build settings
The Build settings section has the following fields:
| Field | Description | Example |
Build command | The command that builds your site. |
|
Output directory | The folder your build writes the finished site to. |
|
Node version | The Node.js major version to build with. |
|
Environment variables
Builder Cloud has two kinds of environment variables:
| Type | Available | Use for |
Build environment variables | While Builder builds and publishes the site. | Values your build step needs, such as public API URLs compiled into your bundle. |
Production environment variables | To the published site at runtime. | Server-side values, such as API keys and database connection strings. |
Add a variable
- In the build or production variables table, click Add Variable, then enter a key, such as
API_KEY, and its value. - Select Secret if the value is sensitive. To change an existing secret later, enter a new value.
- Click Save.
Each production variable value can be up to 5,000 characters long.
You can also paste the contents of a .env file into a Key field. Builder splits each KEY=value line into its own row. For example:
Apply your changes
Build settings and environment variables take effect the next time you publish. After you save changes to a published site, the Publish button changes to Publish update to show that your live site is using older settings. Click it to redeploy with the new settings.
Settings are locked during a publish. You can't edit build settings while the site is publishing or while other Project changes are in progress. Wait for the current operation to finish, then try again.
For the full publishing flow, visit Publish with Builder Cloud.