Skip to main content
Version: 5.0.3

Configuration file

The configuration is an optional JavaScript file where you can easily configure some parameters of your project. The file named warp.config.js is a module that exports a default object. Alternatively, you can export a function that return these same objects.

This file is optional because our SDK can detect a basic configuration (if you have a dockerfile for example).

caution

If you use the CLI, the configuration file's values are overridden by the CLI's parameters.

The objects exported can be:

  • a docker configuration
  • a server configuration
  • a hosting configuration

Docker config

If there is no docker configuration but there is a dockerfile in your server directory, a default docker configuration will be generated.

Example of warp.config.js

module.exports = {
docker: "docker",
deployment: {
include: "/.*/",
exclude: "/.git/",
baseUrl: {
id: "docker",
},
configId: "docker",
},
};

Attribute list

docker

The name of your docker. All characters are allowed excepted slash (/).

Default: docker

variables

Set environment variables in the deployments.

See variables.

deployment

deployment.include

Include all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be included.

Default: /.*/

deployment.exclude

Exclude all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be excluded.

Default: .dockerignore file content if it exist, otherwise /\.git/

deployment.variables

Set environment variables in all deployments. If the same variable is declared in the main variables attribute, then it overrides it.

See variables.

deployment.baseUrl
deployment.baseUrl.id

The ID of the base URL used for the deployment. If your environment doesn't have a base URL with this ID, you will be asked to add one.

Default: docker name

deployment.baseUrl.description

A description that will be displayed if you are asked to add a base URL with the provided ID.

deployment.baseUrl.port

The container private port used to serve the URL.

deployment.configId

The ID of the deployment configuration used for the deployment. If your environment doesn't have a deployment configuration with this ID, you will be asked to add one.

Default: docker name

Server config

If there is no server configuration and no dockerfile but there is a scripts.start attribute in your package.json, a default server configuration will be generated.

Example of warp.config.js

module.exports = {
server: "server",
deployment: {
include: "/.*/",
exclude: "/.git/",
baseUrl: {
id: "server",
},
engine: {
node: "16",
},
},
};

Attribute list

server

The name of your server. All characters are allowed excepted slash (/).

Default: name attribute from the package.json

variables

Set environment variables both in the emulator and in the deployments.

See variables.

deployment

deployment.include

Include all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be included.

Default: /.*/

deployment.exclude

Exclude all files matching any of these conditions. Conditions can be a RegExp, an absolute path, or a function. In case of a function, it must take a path parameter, and return true if that path should be excluded.

Default: /\.git/, /node_modules/

deployment.baseUrl
deployment.baseUrl.id

The ID of the base URL used for the deployment. If your environment doesn't have a base URL with this ID, you will be asked to add one.

Default: server name

deployment.baseUrl.description

A description that will be displayed if you are asked to add a base URL with the provided ID.

deployment.engine

A semver range to specify the engine version. The chosen version will be the latest LTS version in your range. If none are LTS, then it will be the latest version in your range.

engine: {
node: "16";
}

Default: engines attribute from the package.json. If not defined then default value is the latest LTS version of node.

deployment.variables

Set environment variables in all deployments. If the same variable is declared in the main variables attribute, then it overrides it.

See variables.

Hosting config

If there is no hosting configuration and no dockerfile, but there is either a public or a static directory in your server directory, a default hosting configuration will be generated.

Example of warp.config.js

module.exports = {
hosting: "hosting",
include: "/.*/",
exclude: "/.git/",
public: "public",
deployment: {
baseUrl: {
id: "hosting",
},
},
};

Attribute List

hosting

The name of your hosting. All characters are allowed excepted slash (/).

Default: hosting-[name] with [name] being the name attribute from the package.json

include

Include all files matching any of these conditions. Conditions can be a RegExp, a path, or a function. In case of a function, it must take a path parameter, and return true if that path should be included.

Default: /.*/

exclude

Exclude all files matching any of these conditions. Conditions can be a RegExp, a path, or a function. In case of a function, it must take a path parameter, and return true if that path should be excluded.

Default: /\.git/, /node_modules/

public

The path to a directory containing your assets.

Default: public

deployment

deployment.baseUrl
deployment.baseUrl.id

The ID of the base URL used for the deployment. If your environment doesn't have a base URL with this ID, you will be asked to add one.

Default: hosting name

deployment.baseUrl.description

A description that will be displayed if you are asked to add a base URL with the provided ID.

Variables

The configuration file provides a way to set environment variables in your projects, see variables.