dw.json connection settings for cartridge uploads
Key Takeaway
Put dw.json at the top level of your repository, where the upload tools read it. The code-version key in dw.json, written with a hyphen, names the code version that receives your uploaded cartridges.
dw.json is a small JSON file that tells the B2C Commerce upload tools three things: which sandbox to connect to, which user to sign in as, and which code version should receive your cartridges. The command-line upload tools and Visual Studio Code read the file from the top level of your repository when they upload cartridges to the server. So the values in this one file decide where your code goes.
What dw.json holds
dw.json holds the information needed to establish a server connection, plus the code version to upload cartridges into. Two tools use it to upload cartridges to a sandbox: the SFRA command-line upload tool and the Prophet Debugger in Visual Studio Code. A typical file looks like this:
{
"hostname": "dev01-web-company5.cloudkicks.com",
"username": "admin",
"password": "passwordjkl",
"code-version": "version1"
}The file must be valid JSON. Each key holds one piece of the connection or upload information:
| Key | What it holds | Example value |
|---|---|---|
hostname | The fully qualified domain name (FQDN) of the sandbox, entered without http or https | dev01-web-company5.cloudkicks.com |
username | A user with Site Development rights | admin |
password | That user's password | passwordjkl |
code-version | The code version that receives the uploaded cartridges | version1 on a new sandbox |
cartridge (optional) | An array of cartridge names | ["cartridge A", "cartridge B"] |
Write the key as code-version, with a hyphen. Because this key names the code version that receives your cartridges, a different value sends your uploads to a different code version.
dw.json is normally unencrypted. The file holds the instance and password data needed to upload code, so you can take extra measures to secure it.