From 6587bd6ea088647964d0d80c3b49ff53d0dde954 Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Thu, 9 May 2019 13:34:33 +0200 Subject: [PATCH] Introduce RS_INPUTSTREAM environment variable --- conf/live.json | 8 ++++++++ src/classes/RestreamerData.js | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/conf/live.json b/conf/live.json index 81211bf9..47cabc39 100644 --- a/conf/live.json +++ b/conf/live.json @@ -322,6 +322,14 @@ "defaultValue": "false", "required": false, "description": "Enables HTTPS support for admin interface and embeddable player." + }, + { + "name": "RS_INPUTSTREAM", + "alias": [], + "type": "string", + "defaultValue": "", + "required": false, + "description": "Automatically start pulling from this stream on a fresh Restreamer installation." } ] } diff --git a/src/classes/RestreamerData.js b/src/classes/RestreamerData.js index 02ae66ff..adb3d7b3 100644 --- a/src/classes/RestreamerData.js +++ b/src/classes/RestreamerData.js @@ -147,6 +147,14 @@ class RestreamerData { 'repeatToOptionalOutput': 'stop' } }; + + // Set stream source and start streaming on a fresh installation + if(process.env.RS_INPUTSTREAM != '') { + defaultStructure.addresses.srcAddress = process.env.RS_INPUTSTREAM; + defaultStructure.states.repeatToLocalNginx.type = 'connected'; + defaultStructure.userActions.repeatToLocalNginx = 'start'; + } + logger.debug(`Error reading "v1.db": ${error.toString()}`); if (!fs.existsSync(dbPath)) { fs.mkdirSync(dbPath);