server.json

Save your server settings in a portable server.json instead of repeating flags.

On this page

Typing flags on every start gets old. In this lesson you will save your server settings in a server.json in the project root so anyone can start the same server.

Every server start saves the settings it used to this file. Anything you leave off the command line is read back from it.

A starter file

{
    "name": "my-app",
    "web": {
        "host": "127.0.0.1",
        "http": {
            "port": 8080
        }
    },
    "app": {
        "cfengine": "boxlang"
    },
    "jvm": {
        "heapSize": 512,
        "args": [
            "-XX:+UseG1GC"
        ]
    }
}
  • name is the short name shown in server list.
  • web.http.port and web.host set where it listens.
  • app.cfengine picks the engine, the same value as cfengine= on the command line.
  • jvm.heapSize is in megabytes, and jvm.args takes extra JVM arguments.

Engine value above is an example. Leave app.cfengine out to get the default.

Edit it from the command line

server set writes a setting for you, and server show reads it back.

box server set web.http.port=9000
box server show web.http.port
box server clear web.http.port

Now plain box server start uses your settings. Commit server.json to Git and your whole team gets the same server.

Recap

  • server.json in the project root stores your server settings.
  • Key settings are name, web.http.port, web.host, app.cfengine and jvm.
  • Use server set, server show and server clear instead of hand editing.
Edit this page Download Markdown Last updated Nov 30, 2026, 8:08:15 PM Report an issue
Lesson 9 of 15 - Learn CommandBox