Configuring Now

This guide explains how to use these methods to configure and customize the default behavior of Now CLI and Now Desktop.
In addition to the options available in the command line interface (like --name for setting then name of the deployment), we also support saving certain parameters into a config file of your choice.
The types of configuration files can be devided into two groups:

Local Configuration

This describes the set of configuration rules that are applied per project. The configuration file always lives in the root directory of the project (except when a custom path is specified using the --local-config flag in Now CLI).
You can choose between creating a separate file for configuring Now (named now.json) or using the package.json file for this (if it's a Node.js project). Please note that it's not possible to add both files to a project. If both exist, you'll be asked to remove one.

package.json

If you have a JavaScript-based project (like a Node.js server or a frontend with a build script), you are already using package.json.
As a convenience, we allow for settings to be defined within the now namespace inside the file. For example, let's say you wanted to always alias a deployment to cool.now.sh upon deployment. Your package.json would look as follows:
{
  "name": "my-node-project",
  "dependencies": {
    "micro": "latest"
  },
  "now": {
    "alias": "cool"
  },
  "scripts": {
    "start": "micro"
  }
}
For a list of all available options, refer to the "Settings" section below.

now.json

For every type of deployment, including package.json ones, you can create a now.json file that contains your deployment's configuration.
For example, consider a static deployment with some .html files in a directory called my-website.
Since no configuration is supplied, the deployment's name is obtained from the directory. To customize this, you can create a now.json file inside it as follows:
{
  "name": "my-new-name"
}
For a list of all available options, refer to the "Settings" section below.

Settings

All of the properties mentioned below can be used both in the package.json and inside the now.json file:

"name" (string)

The prefix for all new deployment instances. The CLI usually generates this field automatically based on the name of the directory. But if you'd like to define it explicitly, this is the way to go.
"name": "zeit-chat"

"alias" (string|array)

Aliases which will be assigned to the latest deployment when running now alias (with no arguments).
"alias": "zeit.chat"

"alias": [
  "zeit.chat"
]

"env" (object|array)

A list of environment variables to be set on each new deployment instance.
"env": {
  "DATABASE_NAME": "test"
}
If an array is used, the user will be prompted for the value of each environment flag when deploying the project:
"env": [
  "DATABASE_NAME"
]

"dotenv" (boolean|string)

Read environment variables from dotenv file.
"dotenv": true

"dotenv": ".env.production"

"files" (array)

A list of files and directories to be force-uploaded to the deployment (even if they're ignored by .gitignore).
"files": [
  "hello.png",
  "dist"
]

"type" (string)

A field for specifying the deployment type ("node", "docker" or "static") if both package.json and Dockerfile exist. This will prevent now from asking you to choose the type in these cases.
"type": "node"

"forwardNpm" (boolean)

Automatically forward the npm login information to our servers to install private npm packages.
"forwardNpm": true

"public" (boolean)

Controls if _src should be available or not. By default, this property is set to true if your account is using the OSS plan and false if the Premium plan is in use.
"public": true

"engines" (object)

In general, we recommend letting us choose the version, because it ensures that you always take advantage of the latest features, performance improvements and bug fixes.
By default, all new deployments will come with the latest stable version of Node.js
If you need a specific Node.js version we allow you to define the version (semver syntax) of Node.js you want to run on the server:
For an example, this is how to use the latest version of Node.js 6 inside now.
"engines": {
  "node": "^6.0.0"
}

Global Configuration

This describes the set of configuration rules that apply to all projects and all clients of Now (Now CLI, Now Desktop, etc).
By default, they live in a directory named .now in your home directory. Within it, you can find two files (which you can learn more about below). If you need to specifiy a different location of the directory, you can use the --global-config flag in Now CLI, which takes in a custom path to a directory containing the two files.

config.json

This file can be (if needed) modified manually. It doesn't contain any authentication information, but rather only cached account data and configuration rules that can apply to all Now clients (Now CLI and Now Desktop).

"updateChannel" (string)

For our software, we provide two update channels ("stable" and "canary"). This property lets you pick either one in order to enjoy a different pace of updates.
Read more here about why these channels exist and what they're being used for. As an example, this will make Now Desktop and Now CLI receive canary updates:
"updateChannel": "canary"

auth.json

This file should not be touched manually. It contains the authentication information for all of your providers accessed through a Now client.
In the case that you're uploading your global configurion setup to a potentially unsecure destination, we highly recommend ensuring that this file won't be uploaded, as it allows an attacker to gain access to your provider accounts.