Configuration¶
Blink offers flexible configuration options through command-line flags, environment variables, and configuration files.
Configuration Methods¶
Blink supports three methods of configuration, in order of precedence (highest to lowest):
- Command-line flags
- Environment variables
- Configuration file
- Default values
This means that command-line flags will override environment variables, which will override configuration file values, which will override default values.
Command-line Flags¶
You can configure Blink using command-line flags when you run it:
See the Command Line page for a complete list of available flags.
Environment Variables¶
You can also configure Blink using environment variables. The environment variables are prefixed with BLINK_
and use uppercase with underscores instead of dashes:
export BLINK_PATH="/path/to/watch"
export BLINK_EVENT_ADDR=":8080"
export BLINK_VERBOSE="true"
blink
Configuration File¶
Blink supports configuration through a YAML file. By default, it looks for a file named .blink.yaml
in your home directory. You can specify a different file using the --config
flag:
Here's an example configuration file:
# Directory path to watch for changes
path: "/path/to/watch"
# Value for Access-Control-Allow-Origin header
allowed-origin: "*"
# Address to serve events on ([host][:port])
event-addr: ":8080"
# URL path for the event stream
event-path: "/events"
# Refresh duration for events (in milliseconds)
refresh: 100ms
# Enable verbose logging
verbose: true
# Maximum number of CPUs to use
max-procs: 4
# Include patterns for files
include: "*.js,*.css,*.html"
# Exclude patterns for files
exclude: "node_modules,*.tmp"
# Include event types
events: "write,create"
# Ignore event types
ignore: "chmod"
# Webhook URL
webhook-url: "https://example.com/webhook"
# Webhook method
webhook-method: "POST"
# Webhook headers
webhook-headers: "Authorization:Bearer token,Content-Type:application/json"
# Webhook timeout
webhook-timeout: 5s
# Webhook debounce duration
webhook-debounce-duration: 500ms
# Webhook max retries
webhook-max-retries: 3
Managing Configuration¶
Blink provides a config
subcommand to help you manage your configuration:
# List all configuration values
blink config list
# Get a specific configuration value
blink config get path
# Set a configuration value
blink config set path /path/to/watch
Configuration values set with the config set
command are stored in the configuration file.
Default Values¶
If you don't specify a value for a configuration option, Blink will use the following default values:
Option | Default Value |
---|---|
path | . (current directory) |
allowed-origin | * |
event-addr | :12345 |
event-path | /events |
refresh | 100ms |
verbose | false |
max-procs | Number of available CPUs |
include | `` (empty, include all files) |
exclude | `` (empty, exclude no files) |
events | `` (empty, include all event types) |
ignore | `` (empty, ignore no event types) |
webhook-url | `` (empty, no webhook) |
webhook-method | POST |
webhook-headers | `` (empty, no custom headers) |
webhook-timeout | 5s |
webhook-debounce-duration | 0s (no debouncing) |
webhook-max-retries | 3 |