hookdeck-cli 1.0.0-beta.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -42
- package/bin/hookdeck +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ docker run --rm -it -v $HOME/.config/hookdeck:/root/.config/hookdeck hookdeck/ho
|
|
|
81
81
|
|
|
82
82
|
Installing the CLI provides access to the `hookdeck` command.
|
|
83
83
|
|
|
84
|
-
```sh
|
|
84
|
+
```sh
|
|
85
85
|
hookdeck [command]
|
|
86
86
|
|
|
87
87
|
# Run `--help` for detailed information about CLI commands
|
|
@@ -92,19 +92,24 @@ hookdeck [command] help
|
|
|
92
92
|
|
|
93
93
|
### Login
|
|
94
94
|
|
|
95
|
-
Login with your Hookdeck account.
|
|
95
|
+
Login with your Hookdeck account. This will typically open a browser window for authentication.
|
|
96
96
|
|
|
97
|
-
```sh
|
|
97
|
+
```sh
|
|
98
98
|
hookdeck login
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
If you are in an environment without a browser (e.g., a TTY-only terminal), you can use the `--interactive` (or `-i`) flag to log in by pasting your API key:
|
|
102
|
+
```sh
|
|
103
|
+
hookdeck login --interactive
|
|
104
|
+
```
|
|
105
|
+
|
|
101
106
|
> Login is optional, if you do not login a temporary guest account will be created for you when you run other commands.
|
|
102
107
|
|
|
103
108
|
### Listen
|
|
104
109
|
|
|
105
110
|
Start a session to forward your events to an HTTP server.
|
|
106
111
|
|
|
107
|
-
```sh
|
|
112
|
+
```sh
|
|
108
113
|
hookdeck listen <port-or-URL> <source-alias?> <connection-query?> [--path?]
|
|
109
114
|
```
|
|
110
115
|
|
|
@@ -120,7 +125,7 @@ Contrary to ngrok, **Hookdeck does not allow to append a path to your event URL*
|
|
|
120
125
|
|
|
121
126
|
The second param, `source-alias` is used to select a specific source to listen on. By default, the CLI will start listening on all eligible connections for that source.
|
|
122
127
|
|
|
123
|
-
```sh
|
|
128
|
+
```sh
|
|
124
129
|
$ hookdeck listen 3000 shopify
|
|
125
130
|
|
|
126
131
|
👉 Inspect and replay events: https://dashboard.hookdeck.com/cli/events
|
|
@@ -141,7 +146,7 @@ Orders Service forwarding to /webhooks/shopify/orders
|
|
|
141
146
|
|
|
142
147
|
`source-alias` can be a comma-separated list of source names (for example, `stripe,shopify,twilio`) or `'*'` (with quotes) to listen to all sources.
|
|
143
148
|
|
|
144
|
-
```sh
|
|
149
|
+
```sh
|
|
145
150
|
$ hookdeck listen 3000 '*'
|
|
146
151
|
|
|
147
152
|
👉 Inspect and replay events: https://dashboard.hookdeck.com/cli/events
|
|
@@ -164,7 +169,7 @@ twilio -> cli-twilio forwarding to /webhooks/twilio
|
|
|
164
169
|
|
|
165
170
|
The 3rd param, `connection-query` can be used to filter the list of connections the CLI will listen to. The connection query can either be the `connection` `alias` or the `path`
|
|
166
171
|
|
|
167
|
-
```sh
|
|
172
|
+
```sh
|
|
168
173
|
$ hookdeck listen 3000 shopify orders
|
|
169
174
|
|
|
170
175
|
👉 Inspect and replay events: https://dashboard.hookdeck.com/cli/events
|
|
@@ -184,7 +189,7 @@ Orders Service forwarding to /webhooks/shopify/orders
|
|
|
184
189
|
|
|
185
190
|
The `--path` flag sets the path to which events are forwarded.
|
|
186
191
|
|
|
187
|
-
```sh
|
|
192
|
+
```sh
|
|
188
193
|
$ hookdeck listen 3000 shopify orders --path /events/shopify/orders
|
|
189
194
|
|
|
190
195
|
👉 Inspect and replay events: https://dashboard.hookdeck.com/cli/events
|
|
@@ -208,26 +213,28 @@ Event logs for your CLI can be found at [https://dashboard.hookdeck.com/cli/even
|
|
|
208
213
|
|
|
209
214
|
Logout of your Hookdeck account and clear your stored credentials.
|
|
210
215
|
|
|
211
|
-
```sh
|
|
216
|
+
```sh
|
|
212
217
|
hookdeck logout
|
|
213
218
|
```
|
|
214
219
|
|
|
215
220
|
### Skip SSL validation
|
|
216
221
|
|
|
217
|
-
|
|
218
|
-
|
|
222
|
+
When forwarding events to an HTTPS URL as the first argument to `hookdeck listen` (e.g., `https://localhost:1234/webhook`), you might encounter SSL validation errors if the destination is using a self-signed certificate.
|
|
223
|
+
|
|
224
|
+
For local development scenarios, you can instruct the `listen` command to bypass this SSL certificate validation by using its `--insecure` flag. You must provide the full HTTPS URL.
|
|
219
225
|
|
|
220
|
-
**This is dangerous
|
|
226
|
+
**This is dangerous and should only be used in trusted local development environments for destinations you control.**
|
|
221
227
|
|
|
222
|
-
|
|
223
|
-
|
|
228
|
+
Example of skipping SSL validation for an HTTPS destination:
|
|
229
|
+
```sh
|
|
230
|
+
hookdeck listen --insecure https://<your-ssl-url-or-url:port>/ <source-alias?> <connection-query?>
|
|
224
231
|
```
|
|
225
232
|
|
|
226
233
|
### Version
|
|
227
234
|
|
|
228
235
|
Print your CLI version and whether or not a new version is available.
|
|
229
236
|
|
|
230
|
-
```sh
|
|
237
|
+
```sh
|
|
231
238
|
hookdeck version
|
|
232
239
|
```
|
|
233
240
|
|
|
@@ -235,7 +242,7 @@ hookdeck version
|
|
|
235
242
|
|
|
236
243
|
Configure auto-completion for Hookdeck CLI. It is run on install when using Homebrew or Scoop. You can optionally run this command when using the binaries directly or without a package manager.
|
|
237
244
|
|
|
238
|
-
```sh
|
|
245
|
+
```sh
|
|
239
246
|
hookdeck completion
|
|
240
247
|
```
|
|
241
248
|
|
|
@@ -243,7 +250,7 @@ hookdeck completion
|
|
|
243
250
|
|
|
244
251
|
If you want to use Hookdeck in CI for tests or any other purposes, you can use your HOOKDECK_API_KEY to authenticate and start forwarding events.
|
|
245
252
|
|
|
246
|
-
```sh
|
|
253
|
+
```sh
|
|
247
254
|
$ hookdeck ci --api-key $HOOKDECK_API_KEY
|
|
248
255
|
Done! The Hookdeck CLI is configured in project MyProject
|
|
249
256
|
|
|
@@ -264,51 +271,186 @@ Inventory Service forwarding to /webhooks/shopify/inventory
|
|
|
264
271
|
|
|
265
272
|
### Manage active project
|
|
266
273
|
|
|
267
|
-
If you are a part of multiple
|
|
274
|
+
If you are a part of multiple projects, you can switch between them using our project management commands.
|
|
268
275
|
|
|
269
|
-
|
|
276
|
+
To list your projects, you can use the `hookdeck project list` command. It can take optional organization and project name substrings to filter the list. The matching is partial and case-insensitive.
|
|
277
|
+
|
|
278
|
+
```sh
|
|
279
|
+
# List all projects
|
|
270
280
|
$ hookdeck project list
|
|
271
|
-
My Project (current)
|
|
272
|
-
Another Project
|
|
273
|
-
Yet Another One
|
|
281
|
+
My Org / My Project (current)
|
|
282
|
+
My Org / Another Project
|
|
283
|
+
Another Org / Yet Another One
|
|
284
|
+
|
|
285
|
+
# List projects with "Org" in the organization name and "Proj" in the project name
|
|
286
|
+
$ hookdeck project list Org Proj
|
|
287
|
+
My Org / My Project (current)
|
|
288
|
+
My Org / Another Project
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
To select or change the active project, use the `hookdeck project use` command. When arguments are provided, it uses exact, case-insensitive matching for the organization and project names.
|
|
292
|
+
|
|
293
|
+
```console
|
|
294
|
+
hookdeck project use [<organization_name> [<project_name>]]
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Behavior:**
|
|
298
|
+
|
|
299
|
+
- **`hookdeck project use`** (no arguments):
|
|
300
|
+
An interactive prompt will guide you through selecting your organization and then the project within that organization.
|
|
301
|
+
```sh
|
|
302
|
+
$ hookdeck project use
|
|
303
|
+
Use the arrow keys to navigate: ↓ ↑ → ←
|
|
304
|
+
? Select Organization:
|
|
305
|
+
My Org
|
|
306
|
+
▸ Another Org
|
|
307
|
+
...
|
|
308
|
+
? Select Project (Another Org):
|
|
309
|
+
Project X
|
|
310
|
+
▸ Project Y
|
|
311
|
+
Selecting project Project Y
|
|
312
|
+
Successfully set active project to: [Another Org] Project Y
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
- **`hookdeck project use <organization_name>`** (one argument):
|
|
316
|
+
Filters projects by the specified `<organization_name>`.
|
|
317
|
+
- If multiple projects exist under that organization, you'll be prompted to choose one.
|
|
318
|
+
- If only one project exists, it will be selected automatically.
|
|
319
|
+
```sh
|
|
320
|
+
$ hookdeck project use "My Org"
|
|
321
|
+
# (If multiple projects, prompts to select. If one, auto-selects)
|
|
322
|
+
Successfully set active project to: [My Org] Default Project
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
- **`hookdeck project use <organization_name> <project_name>`** (two arguments):
|
|
326
|
+
Directly selects the project `<project_name>` under the organization `<organization_name>`.
|
|
327
|
+
```sh
|
|
328
|
+
$ hookdeck project use "My Corp" "API Staging"
|
|
329
|
+
Successfully set active project to: [My Corp] API Staging
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Upon successful selection, you will generally see a confirmation message like:
|
|
333
|
+
`Successfully set active project to: [<organization_name>] <project_name>`
|
|
334
|
+
|
|
335
|
+
## Configuration files
|
|
336
|
+
|
|
337
|
+
The Hookdeck CLI uses configuration files to store the your keys, project settings, profiles, and other configurations.
|
|
338
|
+
|
|
339
|
+
### Configuration file name and locations
|
|
340
|
+
|
|
341
|
+
The CLI will look for the configuration file in the following order:
|
|
342
|
+
|
|
343
|
+
1. The `--config` flag, which allows you to specify a custom configuration file name and path per command.
|
|
344
|
+
2. The local directory `.hookdeck/config.toml`.
|
|
345
|
+
3. The default global configuration file location.
|
|
346
|
+
|
|
347
|
+
### Default configuration Location
|
|
348
|
+
|
|
349
|
+
The default configuration location varies by operating system:
|
|
350
|
+
|
|
351
|
+
- **macOS/Linux**: `~/.config/hookdeck/config.toml`
|
|
352
|
+
- **Windows**: `%USERPROFILE%\.config\hookdeck\config.toml`
|
|
274
353
|
|
|
275
|
-
|
|
276
|
-
Use the arrow keys to navigate: ↓ ↑ → ←
|
|
277
|
-
? Select Project:
|
|
278
|
-
My Project
|
|
279
|
-
Another Project
|
|
280
|
-
▸ Yet Another One
|
|
354
|
+
The CLI follows the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) on Unix-like systems, respecting the `XDG_CONFIG_HOME` environment variable if set.
|
|
281
355
|
|
|
282
|
-
|
|
356
|
+
### Configuration File Format
|
|
283
357
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
358
|
+
The Hookdeck CLI configuration file is stored in TOML format and typically includes:
|
|
359
|
+
|
|
360
|
+
```toml
|
|
361
|
+
api_key = "api_key_xxxxxxxxxxxxxxxxxxxx"
|
|
362
|
+
project_id = "tm_xxxxxxxxxxxxxxx"
|
|
363
|
+
project_mode = "inbound" | "console"
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Local Configuration
|
|
367
|
+
|
|
368
|
+
The Hookdeck CLI also supports local configuration files. If you run the CLI commands in a directory that contains a `.hookdeck/config.toml` file, the CLI will use that file for configuration instead of the global one.
|
|
369
|
+
|
|
370
|
+
### Using Profiles
|
|
371
|
+
|
|
372
|
+
The `config.toml` file supports profiles which give you the ability to save different CLI configuration within the same configuration file.
|
|
373
|
+
|
|
374
|
+
You can create new profiles by either running `hookdeck login` or `hookdeck use` with the `-p` flag and a profile name. For example:
|
|
375
|
+
|
|
376
|
+
```sh
|
|
377
|
+
hookdeck login -p dev
|
|
287
378
|
```
|
|
288
379
|
|
|
289
|
-
|
|
380
|
+
If you know the name of your Hookdeck organization and the project you want to use with a profile you can use the following:
|
|
290
381
|
|
|
291
|
-
```sh
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
382
|
+
```sh
|
|
383
|
+
hookdeck project use org_name proj_name -p prod
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
This will results in the following config file that has two profiles:
|
|
387
|
+
|
|
388
|
+
```toml
|
|
389
|
+
profile = "dev"
|
|
390
|
+
|
|
391
|
+
[dev]
|
|
392
|
+
api_key = "api_key_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
393
|
+
project_id = "tm_5JxTelcYxOJy"
|
|
394
|
+
project_mode = "inbound"
|
|
298
395
|
|
|
299
|
-
|
|
396
|
+
[prod]
|
|
397
|
+
api_key = "api_key_yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
|
|
398
|
+
project_id = "tm_U9Zod13qtsHp"
|
|
399
|
+
project_mode = "inbound"
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
This allows you to run commands against different projects. For example, to listen to the `webhooks` source in the `dev` profile, run:
|
|
403
|
+
|
|
404
|
+
```sh
|
|
405
|
+
hookdeck listen 3030 webhooks -p dev
|
|
300
406
|
```
|
|
301
407
|
|
|
302
|
-
|
|
408
|
+
To listen to the `webhooks` source in the `prod` profile, run:
|
|
409
|
+
|
|
410
|
+
```sh
|
|
411
|
+
hookdeck listen 3030 webhooks -p prod
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
## Global Flags
|
|
415
|
+
|
|
416
|
+
The following flags can be used with any command:
|
|
417
|
+
|
|
418
|
+
* `--api-key`: Your API key to use for the command.
|
|
419
|
+
* `--color`: Turn on/off color output (on, off, auto).
|
|
420
|
+
* `--config`: Path to a specific configuration file.
|
|
421
|
+
* `--device-name`: A unique name for your device.
|
|
422
|
+
* `--insecure`: Allow invalid TLS certificates.
|
|
423
|
+
* `--log-level`: Set the logging level (debug, info, warn, error).
|
|
424
|
+
* `--profile` or `-p`: Use a specific configuration profile.
|
|
425
|
+
|
|
426
|
+
There are also some hidden flags that are mainly used for development and debugging:
|
|
427
|
+
|
|
428
|
+
* `--api-base`: Sets the API base URL.
|
|
429
|
+
* `--dashboard-base`: Sets the web dashboard base URL.
|
|
430
|
+
* `--console-base`: Sets the web console base URL.
|
|
431
|
+
* `--ws-base`: Sets the Websocket base URL.
|
|
432
|
+
|
|
303
433
|
|
|
304
434
|
## Developing
|
|
305
435
|
|
|
436
|
+
Running from source:
|
|
437
|
+
|
|
438
|
+
```sh
|
|
439
|
+
go run main.go
|
|
440
|
+
```
|
|
441
|
+
|
|
306
442
|
Build from source by running:
|
|
307
443
|
|
|
308
444
|
```sh
|
|
309
445
|
go build
|
|
310
446
|
```
|
|
311
447
|
|
|
448
|
+
Then run the locally generated `hookdeck-cli` binary:
|
|
449
|
+
|
|
450
|
+
```sh
|
|
451
|
+
./hookdeck-cli
|
|
452
|
+
```
|
|
453
|
+
|
|
312
454
|
### Testing against a local API
|
|
313
455
|
|
|
314
456
|
When testing against a non-production Hookdeck API, you can use the
|
package/bin/hookdeck
CHANGED
|
Binary file
|