{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/commandbox-server-json/latest.json",
  "title": "CommandBox Server",
  "description": "Configuration file for a CommandBox server",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/Ortus-Solutions/vscode-commandbox/master/resources/schemas/server.schema.json",
    "sourceSha256": "77498f6bedcdcfa4cddf1adfc32e5c017305b43da70e45e3385230a232a908c1"
  },
  "type": "object",
  "properties": {
    "name": {
      "title": "Name",
      "description": "The name of the server",
      "type": "string",
      "default": ""
    },
    "openBrowser": {
      "title": "Open Browser",
      "description": "Controls whether browser opens by default when starting server",
      "type": "boolean",
      "default": true
    },
    "openBrowserURL": {
      "title": "Open Browser URL",
      "description": "Override the URL to open when starting the server",
      "type": "string",
      "default": ""
    },
    "startTimeout": {
      "title": "Server start timeout",
      "description": "The length of time in seconds to wait for the server to start",
      "type": "number",
      "default": 240
    },
    "stopsocket": {
      "title": "Stop Socket",
      "description": "The port the server listens on to receive a stop command",
      "type": "number",
      "default": 0
    },
    "debug": {
      "title": "Debug",
      "description": "Enable debug level logging for server",
      "type": "boolean",
      "default": false
    },
    "trace": {
      "title": "Trace",
      "description": "Enable trace level logging for server",
      "type": "boolean",
      "default": false
    },
    "console": {
      "title": "Console",
      "description": "Start the server in console mode instead of in the background",
      "type": "boolean",
      "default": false
    },
    "trayEnable": {
      "title": "Tray Enable",
      "description": "Control whether the server has an associated icon in the system tray",
      "type": "boolean",
      "default": true
    },
    "trayicon": {
      "title": "Tray Icon",
      "description": "Path to the server's tray icon",
      "type": "string",
      "default": ""
    },
    "trayOptions": {
      "title": "Tray Options",
      "description": "An array of custom menu items to be added to the server's tray menu",
      "type": "array",
      "minItems": 0,
      "items": {
        "$ref": "#/$defs/trayOptionsItem"
      },
      "default": []
    },
    "jvm": {
      "title": "JVM",
      "description": "JVM Options",
      "type": "object",
      "properties": {
        "heapSize": {
          "title": "Max Heap Size",
          "description": "The max heap size of the server",
          "type": [
            "number",
            "string"
          ],
          "default": ""
        },
        "minHeapSize": {
          "title": "Min Heap Size",
          "description": "The starting heap size for the server",
          "type": [
            "number",
            "string"
          ],
          "default": ""
        },
        "args": {
          "title": "JVM Arguments",
          "description": "Ad-hoc JVM args for the server such as -X:name",
          "type": "string",
          "default": ""
        },
        "javaHome": {
          "title": "Java Home Path",
          "description": "Path to custom JRE. Default is the one that the CommandBox CLI is using",
          "type": "string",
          "default": ""
        },
        "javaVersion": {
          "title": "Java Version",
          "description": "A Java installation ID. In its entirety, it has the form <version>_<type>_<arch>_<os>_<jvm-implementation>_<release>",
          "type": "string",
          "default": ""
        }
      }
    },
    "web": {
      "title": "Web",
      "description": "Web Server Options",
      "type": "object",
      "properties": {
        "host": {
          "title": "Host",
          "description": "The default host name of the server",
          "type": "string",
          "default": "127.0.0.1"
        },
        "webroot": {
          "title": "Webroot",
          "description": "Webroot directory",
          "type": "string",
          "default": ""
        },
        "directoryBrowsing": {
          "title": "Directory Browsing",
          "description": "Enables file listing for directories with no welcome file",
          "type": "boolean",
          "default": false
        },
        "accessLogEnable": {
          "title": "Access Log Enable",
          "description": "Enable web server access log",
          "type": "boolean",
          "default": true
        },
        "GZIPEnable": {
          "title": "GZIP Enable",
          "description": "Enable GZip compression in HTTP responses",
          "type": "boolean",
          "default": true
        },
        "welcomeFiles": {
          "title": "Welcome Files",
          "description": "A comma-delimited list of files that you would like CommandBox to look for when a user hits a directory",
          "type": "string",
          "default": ""
        },
        "aliases": {
          "title": "Aliases",
          "description": "Web aliases for the web server, similar to virtual directories",
          "type": "object",
          "additionalProperties": false,
          "default": {},
          "patternProperties": {
            "^(/[^/]+)+$": {
              "title": "Alias",
              "description": "The key is the web-accessible virtual path and the value is the relative or absolute path to the folder the alias points to",
              "type": "string"
            }
          }
        },
        "errorPages": {
          "title": "Error Pages",
          "description": "The error pages that CommandBox servers return. You can have a setting for each status code including a default error page to be used if no other setting applies",
          "type": "object",
          "properties": {
            "default": {
              "title": "Default",
              "description": "Path to default error page",
              "type": "string",
              "default": ""
            }
          },
          "additionalProperties": false,
          "default": {},
          "patternProperties": {
            "^[1-5][0-9]{2}$": {
              "title": "Error Page",
              "description": "The key is the status code integer and the value is a relative (to the web root) path to be loaded for that status code",
              "type": "string"
            }
          }
        },
        "HTTP": {
          "title": "HTTP Settings",
          "description": "Configure the HTTP listener on the server",
          "type": "object",
          "properties": {
            "enable": {
              "title": "Enable",
              "description": "Enable HTTP for this serer",
              "type": "boolean",
              "default": true
            },
            "port": {
              "title": "Port",
              "description": "HTTP port to use",
              "type": "number",
              "default": 0
            }
          }
        },
        "SSL": {
          "title": "SSL",
          "description": "Configure the HTTPS listener on the server",
          "type": "object",
          "properties": {
            "enable": {
              "title": "Enable",
              "description": "Enable HTTPS for this server",
              "type": "boolean",
              "default": false
            },
            "port": {
              "title": "Port",
              "description": "HTTPS port to use",
              "type": "number",
              "default": 1443
            },
            "certFile": {
              "title": "Cert File",
              "description": "Path to SSL cert file",
              "type": "string",
              "default": ""
            },
            "keyFile": {
              "title": "Key File",
              "description": "Path to SSL key file",
              "type": "string",
              "default": ""
            },
            "keyPass": {
              "title": "Key Pass",
              "description": "Password for SSL key file",
              "type": "string",
              "default": ""
            }
          }
        },
        "AJP": {
          "title": "AJP",
          "description": "Configure the AJP listener on the server",
          "type": "object",
          "properties": {
            "enable": {
              "title": "Enable",
              "description": "Enable AJP for this server",
              "type": "boolean",
              "default": false
            },
            "port": {
              "title": "Port",
              "description": "AJP port to use",
              "type": "number",
              "default": 8009
            }
          }
        },
        "rewrites": {
          "title": "Rewrites",
          "description": "Configure URL Rewrites",
          "type": "object",
          "properties": {
            "enable": {
              "title": "Enable",
              "description": "Enable URL Rewrites on this server",
              "type": "boolean",
              "default": false
            },
            "logEnable": {
              "title": "Log Enable",
              "description": "Enable Rewrite log file",
              "type": "boolean",
              "default": false
            },
            "config": {
              "title": "Config",
              "description": "Path to xml config file or .htaccess",
              "type": "string",
              "default": ""
            },
            "statusPath": {
              "title": "Tuckey Status Path",
              "description": "URL path to visit Tuckey status page like '/tuckey-status'",
              "type": "string",
              "default": "/tuckey-status"
            },
            "configReloadSeconds": {
              "title": "Config Reload Seconds",
              "description": "Number of seconds to check rewrite config file for changes",
              "type": "number"
            }
          }
        },
        "basicAuth": {
          "title": "Configure basic authentication",
          "description": "",
          "type": "object",
          "properties": {
            "enable": {
              "title": "Enable",
              "description": "Enable basic auth for this server",
              "type": "boolean",
              "default": true
            },
            "users": {
              "title": "Users",
              "description": "Users who can authenticate to basic auth",
              "type": "object",
              "default": {},
              "additionalProperties": {
                "title": "User",
                "description": "The key is the user name and the value is the password.",
                "type": "string"
              }
            }
          }
        }
      }
    },
    "app": {
      "title": "Application",
      "description": "Application Server Options",
      "type": "object",
      "properties": {
        "logDir": {
          "title": "Log Directory",
          "description": "The folder path where the servlet out, rewrite, and access log are written to",
          "type": "string",
          "default": ""
        },
        "libDirs": {
          "title": "Jar lib Directories",
          "description": "A comma-delimited list of directories from which CommandBox will load JARs",
          "type": "string",
          "default": ""
        },
        "webConfigDir": {
          "title": "Web Context Directory",
          "description": "Directory for Lucee/Railo web context",
          "type": "string",
          "default": ""
        },
        "serverConfigDir": {
          "title": "Server Context Directory",
          "description": "Directory for Lucee/Railo server context",
          "type": "string",
          "default": ""
        },
        "webXML": {
          "title": "Web XML",
          "description": "Path to web.xml file",
          "type": "string",
          "default": ""
        },
        "WARPath": {
          "title": "WAR Path",
          "description": "Path to a local WAR archive or exploded WAR folder.  Mutually exclusive with cfengine.",
          "type": "string",
          "default": ""
        },
        "cfengine": {
          "title": "CFML Engine",
          "description": "An Endpoint ID that resolves to a CF engine such as 'adobe' or 'lucee'. Include version as 'adobe@2016'",
          "type": "string",
          "default": ""
        },
        "restMappings": {
          "title": "REST Mappings",
          "description": "Comma delimited list of paths to map to the CF engine's REST servlet such as '/rest/*,/api/*'",
          "type": "string",
          "default": ""
        },
        "serverHomeDirectory": {
          "title": "Server Home Directory",
          "description": "Path to folder where the server WAR will be expanded",
          "type": "string",
          "default": ""
        },
        "sessionCookieSecure": {
          "title": "Session Cookie Secure",
          "description": "Enable secure session cookies",
          "type": "boolean",
          "default": false
        },
        "sessionCookieHTTPOnly": {
          "title": "Session Cookie HttpOnly",
          "description": "Enable HTTP-only session cookies",
          "type": "boolean",
          "default": false
        }
      }
    },
    "runwar": {
      "title": "Configure RunWar",
      "description": "These settings apply to the underlying Runwar library that starts servers",
      "type": "object",
      "properties": {
        "args": {
          "title": "Arguments",
          "description": "Ad-hoc options for the underlying Runwar library",
          "type": "string",
          "default": ""
        }
      }
    }
  },
  "$defs": {
    "trayOptionsItem": {
      "title": "Tray Option",
      "description": "An object that represents a single tray menu item",
      "type": "object",
      "properties": {
        "label": {
          "title": "Label",
          "description": "Text of menu item",
          "type": "string"
        },
        "action": {
          "title": "Action",
          "description": "Action to perform when user clicks this menu item. 'openfilesystem', 'openbrowser', or 'stopserver'",
          "type": "string"
        },
        "url": {
          "title": "URL",
          "description": "Url to open for 'openbrowser' action",
          "type": "string"
        },
        "disabled": {
          "title": "Disabled",
          "description": "Turn menu item grey and nothing happens when clicking on it",
          "type": "boolean",
          "default": false
        },
        "image": {
          "title": "Image",
          "description": "Path to PNG image to display on menu item next to the label",
          "type": "string",
          "default": ""
        },
        "hotkey": {
          "title": "Hotkey",
          "description": "Keyboard shortcut to choose this menu item",
          "type": "string",
          "default": ""
        },
        "path": {
          "title": "Path",
          "description": "Filesystem path to open for 'openfilesystem' action",
          "type": "string",
          "default": ""
        },
        "items": {
          "title": "Items",
          "description": "Nested menu items",
          "type": "array",
          "minItems": 0,
          "items": {
            "$ref": "#/$defs/trayOptionsItem"
          },
          "default": []
        }
      }
    }
  }
}
