]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Possibility to set custom RTMP/RTMPS hostname (#4811)
authorkontrollanten <6680299+kontrollanten@users.noreply.github.com>
Tue, 1 Mar 2022 12:37:34 +0000 (13:37 +0100)
committerGitHub <noreply@github.com>
Tue, 1 Mar 2022 12:37:34 +0000 (13:37 +0100)
* live: set custom RTMP/RTMPS hostname

closes #4786

* dont use webserver.hostname as default

* check that rtmp/s.hostname is set

config/default.yaml
config/production.yaml.example
server/initializers/checker-before-init.ts
server/initializers/config.ts
server/initializers/constants.ts

index 1e7fb9e5bf284bc26c3a5f3966aa2f7b5da896a8..3588a5ec99f388f07922461549209dc98f75a4a1 100644 (file)
@@ -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:
index d1f18ecdeb78d3d6b99f082f0042561f1a1065b9..73d1ead663792405cc96c0eda255d0a689d29078 100644 (file)
@@ -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:
index d9d90d4b4cd2430182a3e07a315a1e040c08225d..fe70060836c9c78eeb76d059d69473b1423c53ed 100644 (file)
@@ -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',
index c1b82d12f7f7c21a6caf907d6c5f079bcb12ab8c..63056b41d25d6d14ccc40f0e6ac83f07082ed81a 100644 (file)
@@ -297,12 +297,14 @@ const CONFIG = {
 
     RTMP: {
       get ENABLED () { return config.get<boolean>('live.rtmp.enabled') },
-      get PORT () { return config.get<number>('live.rtmp.port') }
+      get PORT () { return config.get<number>('live.rtmp.port') },
+      get HOSTNAME () { return config.get<number>('live.rtmp.hostname') }
     },
 
     RTMPS: {
       get ENABLED () { return config.get<boolean>('live.rtmps.enabled') },
       get PORT () { return config.get<number>('live.rtmps.port') },
+      get HOSTNAME () { return config.get<number>('live.rtmps.hostname') },
       get KEY_FILE () { return config.get<string>('live.rtmps.key_file') },
       get CERT_FILE () { return config.get<string>('live.rtmps.cert_file') }
     },
index 2367e7689c9e92133fa92d351b7d44a0b625c500..3069e235382592bffeb31c9f37121d096b115f65 100644 (file)
@@ -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 () {