Skip to content

Commit

Permalink
feat: add support for protecting the stream sprout server with a key
Browse files Browse the repository at this point in the history
- Close #8
  • Loading branch information
flexiondotorg committed Jul 22, 2024
1 parent a57ee9d commit e42b61e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ Stream Sprout will look for a configuration file in the following locations, in
### Server

The `server:` section is used to configure the RTMP server that Stream Sprout will listen on.
`url:` is the URL that Stream Sprout will listen on; it must be an RTMP URL.
If you remotely host Stream Sprout, you should set `key:` to a secure value to prevent unauthorised access.

```yaml
If `archive_stream:` is `true` Stream Sprout will archive the stream to disk in the directory specified by `archive_path:`.

### Services
Expand Down Expand Up @@ -173,6 +177,7 @@ services:
- Select `Custom` from the `Service` dropdown
- Copy the server `url:` from your Stream Sprout configuration to the `Server` field:
- `rtmp://127.0.0.1:1935` (*default*)
- Copy the `key:` (if you specified one) from your Stream Sprout configuration to the `Stream Key` field

## Limitations

Expand Down
9 changes: 8 additions & 1 deletion stream-sprout
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,18 @@ trap ctrl_c INT
while true; do
echo "Stream Sprout v${VERSION} using ${STREAM_SPROUT_CONFIG}"
SERVER_URL=$(yq e ".server.url" "${STREAM_SPROUT_CONFIG}")
SERVER_KEY=$(yq e ".server.key" "${STREAM_SPROUT_CONFIG}")
if [[ ! "${SERVER_URL}" =~ ^rtmp://.* ]]; then
echo " - Invalid URL: ${SERVER_URL} is not a valid RTMP URL."
exit 1
fi
echo " - Server: ${SERVER_URL}"
echo -n " - Server: ${SERVER_URL}"
if [ "${SERVER_KEY}" != "null" ]; then
SERVER_URL+="/${SERVER_KEY}"
echo " (key required)"
else
echo ""
fi
STREAM_TEE=""
get_stream_tee
ffmpeg \
Expand Down
1 change: 1 addition & 0 deletions stream-sprout.yaml.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
server:
url: "rtmp://127.0.0.1:1935"
key: "<insert your own key here>"
archive_stream: false
archive_path: "${HOME}/Streams"

Expand Down

0 comments on commit e42b61e

Please sign in to comment.