Skip to main content

Environment variables

Our platform defines environment variables that you can use in your project, and allow you to add any variables you want in the configuration file.

Configuration file's variables

You must declare your environment variable in a variables object inside your configuration file. The property names of this object will be the name of your variables. Their value can be a string, an empty string or an object.

Example

variables: {
myfirstvar: "value",
mysecondvar: "",
mythirdvar: {
local: true,
}
}

If it is an object, then its possible values are:

{
local: true,
}

In this case, the value will be taken from the CLI.

{
empty: true,
}

In this case, the variable will be declared but not assigned a value.

{
undef: true,
}

In this case, the variable will be undefined.

Default exported variables

WARP_PORT

Only available for a server.

Contains the port your server listens on.

For example:

const express = require('express')
const app = express()
const port = process.env.WARP_PORT

app.get('/', (req, res) => {
res.send('Hello World!')
})

app.listen(port, () => {
console.log(`Example app listening at http://localhost:${port}`)
})

WARP_ENV

Contains the environment your project is running in.

const express = require('express')
const app = express()
const env = process.env.WARP_ENV

app.get('/', (req, res) => {
res.send('Hello World!')
})

app.listen(port, () => {
console.log(`Example app is running in env ${env}`)
})

PATH

Only available for a server.

Contains the path of the operating system.