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"
]
}
}
nameis the short name shown inserver list.web.http.portandweb.hostset where it listens.app.cfenginepicks the engine, the same value ascfengine=on the command line.jvm.heapSizeis in megabytes, andjvm.argstakes 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.jsonin the project root stores your server settings.- Key settings are
name,web.http.port,web.host,app.cfengineandjvm. - Use
server set,server showandserver clearinstead of hand editing.