From 8d07888728bc5aabc7d0cd6211bc49fc45fd0353 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Tue, 1 Mar 2022 13:37:34 +0100 Subject: [PATCH] Possibility to set custom RTMP/RTMPS hostname (#4811) * live: set custom RTMP/RTMPS hostname closes #4786 * dont use webserver.hostname as default * check that rtmp/s.hostname is set --- config/default.yaml | 2 ++ config/production.yaml.example | 2 ++ server/initializers/checker-before-init.ts | 3 ++- server/initializers/config.ts | 4 +++- server/initializers/constants.ts | 4 ++-- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config/default.yaml b/config/default.yaml index 1e7fb9e5b..3588a5ec9 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -396,6 +396,7 @@ live: rtmp: enabled: true port: 1935 + hostname: 'localhost' rtmps: enabled: false @@ -404,6 +405,7 @@ live: key_file: '' # Absolute path cert_file: '' + hostname: 'localhost' # Allow to transcode the live streaming in multiple live resolutions transcoding: diff --git a/config/production.yaml.example b/config/production.yaml.example index d1f18ecde..73d1ead66 100644 --- a/config/production.yaml.example +++ b/config/production.yaml.example @@ -404,6 +404,7 @@ live: rtmp: enabled: true port: 1935 + hostname: 'localhost' rtmps: enabled: false @@ -412,6 +413,7 @@ live: key_file: '' # Absolute path cert_file: '' + hostname: 'localhost' # Allow to transcode the live streaming in multiple live resolutions transcoding: diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index d9d90d4b4..fe7006083 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts @@ -49,7 +49,8 @@ function checkMissedConfig () { 'search.remote_uri.users', 'search.remote_uri.anonymous', 'search.search_index.enabled', 'search.search_index.url', 'search.search_index.disable_local_search', 'search.search_index.is_default_search', 'live.enabled', 'live.allow_replay', 'live.max_duration', 'live.max_user_lives', 'live.max_instance_lives', - 'live.rtmp.enabled', 'live.rtmp.port', 'live.rtmps.enabled', 'live.rtmps.port', 'live.rtmps.key_file', 'live.rtmps.cert_file', + 'live.rtmp.enabled', 'live.rtmp.port', 'live.rtmp.hostname', + 'live.rtmps.enabled', 'live.rtmps.port', 'live.rtmps.hostname', 'live.rtmps.key_file', 'live.rtmps.cert_file', 'live.transcoding.enabled', 'live.transcoding.threads', 'live.transcoding.profile', 'live.transcoding.resolutions.144p', 'live.transcoding.resolutions.240p', 'live.transcoding.resolutions.360p', 'live.transcoding.resolutions.480p', 'live.transcoding.resolutions.720p', 'live.transcoding.resolutions.1080p', diff --git a/server/initializers/config.ts b/server/initializers/config.ts index c1b82d12f..63056b41d 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts @@ -297,12 +297,14 @@ const CONFIG = { RTMP: { get ENABLED () { return config.get('live.rtmp.enabled') }, - get PORT () { return config.get('live.rtmp.port') } + get PORT () { return config.get('live.rtmp.port') }, + get HOSTNAME () { return config.get('live.rtmp.hostname') } }, RTMPS: { get ENABLED () { return config.get('live.rtmps.enabled') }, get PORT () { return config.get('live.rtmps.port') }, + get HOSTNAME () { return config.get('live.rtmps.hostname') }, get KEY_FILE () { return config.get('live.rtmps.key_file') }, get CERT_FILE () { return config.get('live.rtmps.cert_file') } }, diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index 2367e7689..3069e2353 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts @@ -1046,8 +1046,8 @@ function updateWebserverUrls () { WEBSERVER.HOSTNAME = CONFIG.WEBSERVER.HOSTNAME WEBSERVER.PORT = CONFIG.WEBSERVER.PORT - WEBSERVER.RTMP_URL = 'rtmp://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.LIVE.RTMP.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH - WEBSERVER.RTMPS_URL = 'rtmps://' + CONFIG.WEBSERVER.HOSTNAME + ':' + CONFIG.LIVE.RTMPS.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH + WEBSERVER.RTMP_URL = 'rtmp://' + CONFIG.LIVE.RTMP.HOSTNAME + ':' + CONFIG.LIVE.RTMP.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH + WEBSERVER.RTMPS_URL = 'rtmps://' + CONFIG.LIVE.RTMPS.HOSTNAME + ':' + CONFIG.LIVE.RTMPS.PORT + '/' + VIDEO_LIVE.RTMP.BASE_PATH } function updateWebserverConfig () {