|
| 1 | +--- |
| 2 | +name: commandbox-config-settings |
| 3 | +description: "Use this skill for CommandBox global configuration: config set/show/clear commands, server defaults, ForgeBox API tokens, endpoint settings, proxy configuration, module settings, env var overrides (box_config_*), setting sync across machines, task runner settings, tab completion style, preferred browser, artifacts directory, and nativeShell configuration." |
| 4 | +--- |
| 5 | + |
| 6 | +# CommandBox Config Settings |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +CommandBox has a global configuration file at `~/.CommandBox/CommandBox.json`. Manage it with `config set`, `config show`, and `config clear` commands. |
| 11 | + |
| 12 | +```bash |
| 13 | +# Open config file location |
| 14 | +config show |
| 15 | +# → shows path to CommandBox.json |
| 16 | +``` |
| 17 | + |
| 18 | +--- |
| 19 | + |
| 20 | +## Core Config Commands |
| 21 | + |
| 22 | +```bash |
| 23 | +# Set a value |
| 24 | +config set settingName=value |
| 25 | + |
| 26 | +# Show a value |
| 27 | +config show settingName |
| 28 | + |
| 29 | +# Show all settings |
| 30 | +config show |
| 31 | + |
| 32 | +# Clear / remove a setting |
| 33 | +config clear settingName |
| 34 | + |
| 35 | +# Nested settings (dot notation) |
| 36 | +config set modules.myModule.mySetting=foo |
| 37 | +config show modules.myModule.mySetting |
| 38 | +config clear modules.myModule.mySetting |
| 39 | + |
| 40 | +# Array notation |
| 41 | +config set myArray[1]=firstItem |
| 42 | +config show myArray[1] |
| 43 | + |
| 44 | +# Set multiple at once |
| 45 | +config set setting1=a setting2=b setting3=c |
| 46 | + |
| 47 | +# Set complex JSON value |
| 48 | +config set myArray="['a','b','c']" |
| 49 | +config set myStruct="{ 'key': 'value' }" |
| 50 | + |
| 51 | +# Append to existing array/struct (same type required) |
| 52 | +config set myArray="['d']" --append |
| 53 | + |
| 54 | +# JMESPath filtering in config show |
| 55 | +config show 'jq:{name:name, modules:modules}' |
| 56 | +config show 'jq:keys(modules)' |
| 57 | +config show "jq:key_contains(modules,'commandbox')" |
| 58 | +``` |
| 59 | + |
| 60 | +--- |
| 61 | + |
| 62 | +## Server Defaults |
| 63 | + |
| 64 | +Set default server start settings applied when not overridden by a specific `server.json`: |
| 65 | + |
| 66 | +```bash |
| 67 | +# Common server defaults |
| 68 | +config set server.defaults.openBrowser=false |
| 69 | +config set server.defaults.profile=production |
| 70 | +config set server.defaults.jvm.heapSize=1024 |
| 71 | +config set server.defaults.jvm.heapSize=2G |
| 72 | +config set server.defaults.web.rewrites.enable=true |
| 73 | +config set server.defaults.web.directoryBrowsing=false |
| 74 | +config set server.defaults.web.http.port=8080 |
| 75 | +config set server.defaults.trayEnable=false |
| 76 | + |
| 77 | +# Show all server defaults |
| 78 | +config show server.defaults |
| 79 | +``` |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +## ForgeBox API Token & Endpoints |
| 84 | + |
| 85 | +```bash |
| 86 | +# Set ForgeBox API token (obtain from forgebox.io account) |
| 87 | +config set endpoints.forgebox.APIToken=your-secret-api-token |
| 88 | + |
| 89 | +# Login (sets token automatically) |
| 90 | +forgebox login |
| 91 | + |
| 92 | +# Register a custom ForgeBox Enterprise endpoint |
| 93 | +forgebox endpoint register myCompany https://forge.mycompany.com/api/v1 |
| 94 | + |
| 95 | +# Set token for enterprise endpoint |
| 96 | +config set endpoints.forgebox-myCompany.APIToken=company-token |
| 97 | +config set endpoints.forgebox-myCompany.APIURL=https://forge.mycompany.com/api/v1 |
| 98 | + |
| 99 | +# Show all endpoints |
| 100 | +forgebox endpoint list |
| 101 | +config show endpoints |
| 102 | +``` |
| 103 | + |
| 104 | +--- |
| 105 | + |
| 106 | +## Module Settings |
| 107 | + |
| 108 | +Override defaults for any installed module: |
| 109 | + |
| 110 | +```bash |
| 111 | +# Set module setting |
| 112 | +config set modules.myModule.verbose=true |
| 113 | +config set modules.myModule.apiUrl=https://api.example.com |
| 114 | +config set modules.myModule.timeout=30 |
| 115 | + |
| 116 | +# Show module settings |
| 117 | +config show modules.myModule |
| 118 | + |
| 119 | +# Clear a module setting |
| 120 | +config clear modules.myModule.verbose |
| 121 | +``` |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## Proxy Configuration |
| 126 | + |
| 127 | +For environments behind a corporate HTTP proxy: |
| 128 | + |
| 129 | +```bash |
| 130 | +config set proxy.server=proxy.example.com |
| 131 | +config set proxy.port=8080 |
| 132 | +config set proxy.user=myuser |
| 133 | +config set proxy.password=mypassword |
| 134 | + |
| 135 | +# Show proxy settings |
| 136 | +config show proxy |
| 137 | +``` |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +## Misc Settings |
| 142 | + |
| 143 | +```bash |
| 144 | +# Use custom native shell (default: /bin/sh) |
| 145 | +config set nativeShell=/bin/zsh |
| 146 | +config set nativeShell=/bin/bash |
| 147 | + |
| 148 | +# Custom artifacts cache directory |
| 149 | +config set artifactsDirectory=/fast-ssd/commandbox-artifacts |
| 150 | + |
| 151 | +# Preferred browser for opening URLs |
| 152 | +config set preferredBrowser=chrome # chrome, firefox, edge, safari, opera |
| 153 | + |
| 154 | +# Enable ANSI colors in non-interactive terminals (CI/CD) |
| 155 | +config set colorInDumbTerminal=true |
| 156 | + |
| 157 | +# Disable auto-update checks |
| 158 | +config set autoUpdateCheck=false |
| 159 | + |
| 160 | +# Git tag prefix for bump command |
| 161 | +config set tagPrefix='' # removes 'v' prefix (default: 'v') |
| 162 | +config set tagVersion=false # don't auto-tag on bump |
| 163 | + |
| 164 | +# Inline tab completion (restart required) |
| 165 | +config set tabCompleteInline=true |
| 166 | +``` |
| 167 | + |
| 168 | +--- |
| 169 | + |
| 170 | +## Env Var Overrides |
| 171 | + |
| 172 | +Any config setting can be overridden with OS environment variables without modifying `CommandBox.json`. Useful for CI/CD pipelines. |
| 173 | + |
| 174 | +**Convention**: prefix with `box_config_` and use underscores for nested keys. |
| 175 | + |
| 176 | +```bash |
| 177 | +# Simple setting |
| 178 | +export box_config_colorInDumbTerminal=true |
| 179 | + |
| 180 | +# ForgeBox API token |
| 181 | +export box_config_endpoints_forgebox_APIToken=my-token-here |
| 182 | + |
| 183 | +# Nested with dots (Windows cmd allows special chars) |
| 184 | +box_config_endpoints.forgebox.APIToken=my-token-here |
| 185 | + |
| 186 | +# Complex JSON value |
| 187 | +export box_config_proxy='{"server":"proxy.corp.com","port":8080}' |
| 188 | + |
| 189 | +# Module setting |
| 190 | +export box_config_modules_myModule_verbose=true |
| 191 | + |
| 192 | +# Hyphenated module names (use full JSON) |
| 193 | +export box_config_modules='{"commandbox-bullet-train":{"showGitBranch":true}}' |
| 194 | +``` |
| 195 | + |
| 196 | +> Env var overrides **do not** persist to `CommandBox.json` and are lost when the shell exits. They override any explicitly set values. |
| 197 | +
|
| 198 | +### Java System Property Overrides (CLI JVM) |
| 199 | + |
| 200 | +```bash |
| 201 | +# Pass as -D flag when starting box |
| 202 | +box -Dbox_config_colorInDumbTerminal=true |
| 203 | + |
| 204 | +# Or in commandbox.properties |
| 205 | +jvm.args=-Dbox_config_endpoints_forgebox_APIToken=my-token |
| 206 | +``` |
| 207 | + |
| 208 | +--- |
| 209 | + |
| 210 | +## Setting Sync |
| 211 | + |
| 212 | +Sync your config settings across machines using your preferred source control or cloud sync: |
| 213 | + |
| 214 | +```bash |
| 215 | +# Export all settings to a file |
| 216 | +config show --json > my-commandbox-settings.json |
| 217 | + |
| 218 | +# Import settings from a file |
| 219 | +recipe my-commandbox-settings.boxr |
| 220 | + |
| 221 | +# Or use symlinks to sync CommandBox.json via Dropbox/iCloud/Git |
| 222 | +# ln -s ~/Dropbox/commandbox/CommandBox.json ~/.CommandBox/CommandBox.json |
| 223 | +``` |
| 224 | + |
| 225 | +--- |
| 226 | + |
| 227 | +## Task Runner Settings |
| 228 | + |
| 229 | +```bash |
| 230 | +# Set default task file name convention |
| 231 | +config set taskRunner.taskFile=task |
| 232 | + |
| 233 | +# Set default target |
| 234 | +config set taskRunner.target=run |
| 235 | +``` |
| 236 | + |
| 237 | +--- |
| 238 | + |
| 239 | +## Complete Config Reference |
| 240 | + |
| 241 | +| Setting | Type | Description | |
| 242 | +|---------|------|-------------| |
| 243 | +| `server.defaults` | struct | Global server.json defaults | |
| 244 | +| `endpoints.forgebox.APIToken` | string | ForgeBox API token | |
| 245 | +| `endpoints.forgebox.APIURL` | string | Custom ForgeBox API URL | |
| 246 | +| `modules.<name>.*` | struct | Per-module settings | |
| 247 | +| `proxy.server` | string | HTTP proxy hostname | |
| 248 | +| `proxy.port` | number | HTTP proxy port | |
| 249 | +| `proxy.user` | string | Proxy username | |
| 250 | +| `proxy.password` | string | Proxy password | |
| 251 | +| `nativeShell` | string | Shell for OS commands (default: `/bin/sh`) | |
| 252 | +| `artifactsDirectory` | string | Package cache location | |
| 253 | +| `preferredBrowser` | string | Default browser for `openURL()` | |
| 254 | +| `colorInDumbTerminal` | boolean | ANSI colors in CI/non-TTY | |
| 255 | +| `autoUpdateCheck` | boolean | Check for CommandBox updates on start | |
| 256 | +| `tagVersion` | boolean | Auto-tag Git repo on `bump` | |
| 257 | +| `tagPrefix` | string | Tag prefix for `bump` (default: `v`) | |
| 258 | +| `tabCompleteInline` | boolean | Inline tab completion style | |
| 259 | +| `developerMode` | boolean | Reload shell before each command (dev only) | |
0 commit comments