File size: 8,267 Bytes
6a7089a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | # Config
`pinchtab config` is the CLI entry point for creating, inspecting, validating, and editing PinchTab's config file.
Use this page as the command and schema reference. Broader deployment patterns can move to a separate guide later.
For security posture, token usage, sensitive endpoint policy, and IDPI guidance, see [Security](../guides/security.md).
## Commands
### `pinchtab config`
Opens the interactive config overview/editor.
It currently exposes these high-signal settings directly:
- `multiInstance.strategy`
- `multiInstance.allocationPolicy`
- `instanceDefaults.stealthLevel`
- `instanceDefaults.tabEvictionPolicy`
It also shows:
- the active config file path
- the dashboard URL when the server is running
- the masked server token
- a `Copy token` action for clipboard/manual copy
```bash
pinchtab config
```
### `pinchtab config init`
Creates a default config file at the standard user config location.
```bash
pinchtab config init
```
Current behavior note:
- `config init` writes to the default config path
- it does not currently switch to a custom `PINCHTAB_CONFIG` target path
### `pinchtab config show`
Shows the effective runtime configuration after applying:
```text
env vars -> config file -> built-in defaults
```
```bash
pinchtab config show
```
### `pinchtab config path`
Prints the config file path PinchTab will read.
```bash
pinchtab config path
```
### `pinchtab config validate`
Validates the current config file.
```bash
pinchtab config validate
```
### `pinchtab config get`
Reads a single dotted-path value from the config file.
```bash
pinchtab config get server.port
pinchtab config get instanceDefaults.mode
pinchtab config get security.attach.allowHosts
```
### `pinchtab config set`
Sets a single dotted-path value in the config file.
```bash
pinchtab config set server.port 8080
pinchtab config set instanceDefaults.mode headed
pinchtab config set multiInstance.strategy explicit
```
### `pinchtab config patch`
Applies a JSON patch object to the config file.
```bash
pinchtab config patch '{"server":{"port":"8080"}}'
pinchtab config patch '{"instanceDefaults":{"mode":"headed","maxTabs":50}}'
```
## Config Priority
PinchTab loads configuration in this order:
1. environment variables
2. config file
3. built-in defaults
The supported env vars are:
- `PINCHTAB_CONFIG` — path to config file
- `PINCHTAB_TOKEN` — auth token (overrides config file)
Everything else is configured in `config.json`. For CLI targeting a remote server, use the `--server` flag.
For the common local workflow, prefer the interactive `pinchtab config` screen for everyday changes and use `get`, `set`, or `patch` when you need an exact scripted edit.
## Config File Location
Default location by OS:
- macOS: `~/Library/Application Support/pinchtab/config.json`
- Linux: `~/.config/pinchtab/config.json` (respects `$XDG_CONFIG_HOME` if set)
- Windows: `%APPDATA%\pinchtab\config.json`
Legacy fallback:
- if `~/.pinchtab/config.json` exists and the newer location does not, PinchTab still uses the legacy location
Override the read path with:
```bash
export PINCHTAB_CONFIG=/path/to/config.json
```
## Config Shape
Current nested config shape:
```json
{
"server": {
"port": "9867",
"bind": "127.0.0.1",
"token": "your-secret-token",
"stateDir": "/path/to/state"
},
"browser": {
"version": "144.0.7559.133",
"binary": "/path/to/chrome",
"extraFlags": "",
"extensionPaths": []
},
"instanceDefaults": {
"mode": "headless",
"maxTabs": 20,
"maxParallelTabs": 0,
"stealthLevel": "light",
"tabEvictionPolicy": "close_lru",
"blockAds": false,
"blockImages": false,
"blockMedia": false,
"noRestore": false,
"noAnimations": false
},
"security": {
"allowEvaluate": false,
"allowMacro": false,
"allowScreencast": false,
"allowDownload": false,
"allowUpload": false,
"attach": {
"enabled": false,
"allowHosts": ["127.0.0.1", "localhost", "::1"],
"allowSchemes": ["ws", "wss"]
},
"idpi": {
"enabled": true,
"allowedDomains": ["127.0.0.1", "localhost", "::1"],
"strictMode": true,
"scanContent": true,
"wrapContent": true,
"customPatterns": []
}
},
"profiles": {
"baseDir": "/path/to/profiles",
"defaultProfile": "default"
},
"multiInstance": {
"strategy": "always-on",
"allocationPolicy": "fcfs",
"instancePortStart": 9868,
"instancePortEnd": 9968,
"restart": {
"maxRestarts": 20,
"initBackoffSec": 2,
"maxBackoffSec": 60,
"stableAfterSec": 300
}
},
"timeouts": {
"actionSec": 30,
"navigateSec": 60,
"shutdownSec": 10,
"waitNavMs": 1000
},
"scheduler": {
"enabled": false,
"strategy": "fair-fifo",
"maxQueueSize": 1000,
"maxPerAgent": 100,
"maxInflight": 20,
"maxPerAgentInflight": 10,
"resultTTLSec": 300,
"workerCount": 4
}
}
```
## Sections
| Section | Purpose |
| --- | --- |
| `server` | HTTP server settings |
| `browser` | Chrome executable and launch wiring |
| `instanceDefaults` | Default behavior for managed instances |
| `security` | Sensitive feature gates, attach policy, and IDPI |
| `profiles` | Profile storage defaults |
| `multiInstance` | Strategy, allocation, instance port range, and restart policy |
| `timeouts` | Runtime timeouts |
| `scheduler` | Optional task queue (see [Scheduler](./scheduler.md)) |
## Common Examples
### Headed Mode
```json
{
"instanceDefaults": {
"mode": "headed"
}
}
```
### Network Bind With Token
```bash
pinchtab config set server.bind 0.0.0.0
pinchtab config set server.token secret
pinchtab
```
### Custom Instance Port Range
```json
{
"server": {
"port": "8080"
},
"multiInstance": {
"instancePortStart": 8100,
"instancePortEnd": 8200
}
}
```
### Tab Eviction Policy
```json
{
"instanceDefaults": {
"maxTabs": 10,
"tabEvictionPolicy": "close_lru"
}
}
```
### Attach Policy
```json
{
"security": {
"attach": {
"enabled": true,
"allowHosts": ["127.0.0.1", "localhost", "chrome.internal"],
"allowSchemes": ["ws", "wss"]
}
}
}
```
### IDPI Policy
```json
{
"security": {
"idpi": {
"enabled": true,
"allowedDomains": ["example.com", "*.example.com"],
"strictMode": true,
"scanContent": true,
"wrapContent": true,
"customPatterns": []
}
}
}
```
This is policy only. The actual `cdpUrl` is provided in the attach request, not in global config.
## Legacy Flat Format
Older flat config is still accepted for backward compatibility:
```json
{
"port": "9867",
"headless": true,
"maxTabs": 20,
"allowEvaluate": false,
"timeoutSec": 30,
"navigateSec": 60
}
```
Use `pinchtab config init` to create a nested config file.
## Validation
`pinchtab config validate` currently checks, among other things:
- valid server port values
- valid `instanceDefaults.mode`
- valid `instanceDefaults.stealthLevel`
- valid `instanceDefaults.tabEvictionPolicy`
- `instanceDefaults.maxTabs >= 1`
- `instanceDefaults.maxParallelTabs >= 0`
- valid `multiInstance.strategy`
- valid `multiInstance.allocationPolicy`
- valid `multiInstance.restart.*` values
- valid `security.attach.allowSchemes`
- `multiInstance.instancePortStart <= multiInstance.instancePortEnd`
- `multiInstance.restart.initBackoffSec <= multiInstance.restart.maxBackoffSec`
- non-negative timeout values
Valid enum values:
| Field | Values |
| --- | --- |
| `instanceDefaults.mode` | `headless`, `headed` |
| `instanceDefaults.stealthLevel` | `light`, `full` |
| `instanceDefaults.tabEvictionPolicy` | `reject`, `close_oldest`, `close_lru` (default) |
| `multiInstance.strategy` | `simple`, `explicit`, `simple-autorestart`, `always-on` (default) |
| `multiInstance.allocationPolicy` | `fcfs`, `round_robin`, `random` |
| `security.attach.allowSchemes` | `ws`, `wss`, `http`, `https` |
## Notes
- `config show` reports effective runtime values, not just raw file contents.
- `config get`, `set`, and `patch` operate on the file config model, not on transient env overrides.
- Most operational behavior now belongs in `config.json`, not in startup env vars.
|