Currently, the only way to configure the app is through environment variables.
Generally, it is expected for you to be familiar on how to set environment variables. Otherwise, refer to these guides:
The tool will detect the presence of .env
file in the current working directory and will load environment variables from there.
File format is simple: list of name-value pairs in a format ENV_VARIABLE_NAME=value
, one per line.
Example:
TWITCH_BROADCASTERS=123,456
TWITCH_CLIENT_ID=abcdefghijklmnopqrstuvwxyz1234
TWITCH_CLIENT_SECRET=zyxwvutsrqponmlkjihgfedcba4321
TWITCH_WEBHOOK_SECRET=mywebhooksecret
TWITCH_APP_ACCESS_TOKEN_LOCATION=/mnt/data/twitch/app_access_token
TWITCH_MONITOR_STREAMLINK_PATH=/mnt/data/twitch/env/bin/streamlink
TWITCH_MONITOR_STREAMLINK_FILE_DIR=/mnt/data/twitch/recordings
TWITCH_MONITOR_STREAMLINK_LOG_DIR=/mnt/data/twitch/logs
TWITCH_MONITOR_LOG_PRETTY=true
Env variables that are already present in the environment will take the precedence. I.e. if you already have TWITCH_BROADCASTERS
in your environ, its value will be used instead of the one from .env
.
Since Windows is picky to file naming, .env
usage is not always possible. Alternatively, you can create twitch-stream-monitor.bat
and set environment variables explicitly:
set TWITCH_BROADCASTERS=123,456
set TWITCH_CLIENT_ID=abcdefghijklmnopqrstuvwxyz1234
set TWITCH_CLIENT_SECRET=zyxwvutsrqponmlkjihgfedcba4321
set TWITCH_WEBHOOK_SECRET=mywebhooksecret
set TWITCH_APP_ACCESS_TOKEN_LOCATION=D:\twitch\app_access_token
set TWITCH_MONITOR_STREAMLINK_PATH=C:\Program Files (x86)\Streamlink\bin\streamlink.exe
set TWITCH_MONITOR_STREAMLINK_FILE_DIR=D:\twitch\recordings
set TWITCH_MONITOR_STREAMLINK_LOG_DIR=D:\twitch\logs
set TWITCH_MONITOR_LOG_PRETTY=true
start twitch-stream-monitor.exe monitor
- Required: No
- Type: string list
List of channel IDs (not usernames) separated by comma.
IDs can be found using direct API query to Twitch:
curl 'https://api.twitch.tv/helix/users?login=USERNAME' -H 'Client-ID: MY_CLIENT_ID' -H "Authorization: Bearer APP_ACCESS_TOKEN"
- Required: No
- Type: bool
- Default:
false
Define behavior in case there is already a stream.online
event subscription present for given broadcaster id.
Delete (false
) or preserve (true
) such subscriptions at exit.
- Required: No
- Type: bool
- Default:
false
Define behavior for newly-created stream.online
event subscriptions.
Delete (false
) or preserve (true
) such subscriptions at exit.
- Required: No
- Type: bool
- Default:
false
Start listening for stream.online
events even if it is known that they won't be handled properly.
Use at your own risk, mainly useful for debugging.
- Required: No
- Type: bool
- Default:
false
Keep going if creation of stream.online
event subscription fails.
Use at your own risk, mainly useful for debugging.
- Required: No
- Type: string enum
- Possible values:
streamlink
,http
,noop
- Default:
streamlink
See Handlers.
- Required: No
- Type: duration
- Default:
5s
Timeout for pre-startup checks. If check takes longer than specified value, consider it failed and abort the startup.
- Required: Yes
- Type: string
See Credentials.
- Required: Yes
- Type: string
See Credentials.
- Required: No
- Type: string
See Credentials.
- Required: No
- Type: string
See Credentials.
- Required: Yes (if no Ngrok detected), No otherwise
- Type: string
See Webhook.
- Required: Yes
- Type: string
See Webhook.
- Required: No
- Type: string
Hostname to bind to, if not set - listens to all the interfaces.
- Required: No
- Type: unsigned int
- Default:
29177
Port to bind to.
- Required: No
- Type: string
- Default:
streamlink
Path to the streamlink
executable.
- Required: No
- Type: string
- Default:
.
(current working directory)
Directory to store stream recordings.
- Required: No
- Type: string
- Default:
.
(current working directory)
Directory to store stream recordings logs.
- Required: No
- Type: string
Path to the streamlink configuration file.
- Required: No
- Type: duration
- Default:
60s
When shutting down the tool, the time for running streamlink recordings to gracefully shutdown. I.e. time after sending SIGTERM
before issuing SIGKILL
.
- Required: No
- Type: string
URL to send callback to by http
handler.
- Required: No
- Type: string
Username to use with HTTP Basic Auth for http
handler.
- Required: No
- Type: string
Password to use with HTTP Basic Auth for http
handler.
- Required: No
- Type: string
See Ngrok.
- Required: No
- Type: string
See Ngrok.
- Required: No
- Type: string enum
- Default:
info
- Possible values:
trace
,debug
,info
,warn
,error
,fatal
,panic
Log verbosity.
- Required: No
- Type: bool
- Default:
false
Enable human-friendly logging.
- Required: No
- Type: bool
- Default:
false
Output logs to stdout instead of the stderr. Useful when running in docker.