The layer0.config.js config file in your app's root directory contains configuration options that control how your app runs on Layer0. This file is automatically created when you run layer0 init. It should export an object with the following properties:

The backends config is an object whose keys are backend names and whose values are:

PropertyTypeDescription
domainOrIpString(Required) The domain or ip address for the backend site or API.
hostHeaderStringA value to send as the host header when sending requests to the backend site or API. By default the host header sent from the browser is used.
disableCheckCertBooleanA flag to turn off the TLS certificate check when making proxy requests to the backend site or API. By default it is false and for security purposes we strongly recommend that it is kept false in production environments. When using this option, you may also want to run your app with the NODE_TLS_REJECT_UNAUTHORIZED environment variable set to "0" to allow node to fetch from sites with invalid certificates.
portNumberThe port on which the backend receives https requests. Defaults to 443 but you can specify any other acceptable port value. Note that specifying 80 has no special meaning as Layer0 will never send secured requests to unsecured backends. To enable HTTP traffic on a backend you must have a route matching http protocol in your router and serve content from that route. All HTTP traffic assumes port 80 on the backend.

The name of the connector package corresponding to the framework your app uses, or the path to a directory that implements the connector interface.

Example

To use a connector package:

connector: '@layer0/next'

To implement a connector directly within your project:

connector: './path/to/connector/dir' ## this directory should have build.js, prod.js, and dev.js

The path to your routes file relative to the root of your app. Defaults to routes.js.

If true, the packages listed in the dependencies property of package.json will be included in the build that is deployed to Layer0.

Allows you to include additional resources in the bundle that is deployed to Layer0's serverless JS workers. Keys are globs, value can be a boolean or string. This is typically used to ensure that resources that need to be dynamically required at runtime such as build manifests for server-side rendering or other config files are present in the cloud.

Examples

includeFiles: {
  'lang/**/*': true,
},

or if you need to copy into a specific directory within the Layer0 build:

includeFiles: {
  'lang/**/*': 'another/dir/in/layer0/lambda',
},

The maximum number of URLs that will be concurrently prendered during deployment when static prerendering is enabled. Defaults to 200, which is the maximum allowed value.

A list of glob patterns identifying which source files should be uploaded when running layer0 deploy --includeSources. This option is primary used to share source code with Layer0 support personnel for the purpose of debugging. If omitted, layer0 deploy --includeSources will result in all files which are not gitignored being uploaded to Layer0.

Example:

sources: [
  '**/*', // include all files
  '!(**/secrets/**/*)', // except everything in the secrets directory
]