This commit is contained in:
Ingo Oppermann
2022-10-10 14:54:35 +02:00
parent eb57fb5e70
commit f896c1a9ac

View File

@@ -649,7 +649,8 @@ func (a *api) start() error {
var autocertManager *certmagic.Config
if cfg.TLS.Enable && cfg.TLS.Auto {
if cfg.TLS.Enable {
if cfg.TLS.Auto {
if len(cfg.Host.Name) == 0 {
return fmt.Errorf("at least one host must be provided in host.name or RS_HOST_NAME")
}
@@ -742,6 +743,9 @@ func (a *api) start() error {
cfg.TLS.CertFile = ""
cfg.TLS.KeyFile = ""
}
} else {
a.log.logger.core.Info().Log("Enabling TLS with cert and key files")
}
}
if cfg.RTMP.Enable {
@@ -756,14 +760,15 @@ func (a *api) start() error {
Collector: a.sessions.Collector("rtmp"),
}
if autocertManager != nil && cfg.RTMP.EnableTLS {
config.TLSConfig = &tls.Config{
GetCertificate: autocertManager.GetCertificate,
}
if cfg.RTMP.EnableTLS {
config.Logger = config.Logger.WithComponent("RTMP/S")
a.log.logger.rtmps = a.log.logger.core.WithComponent("RTMPS").WithField("address", cfg.RTMP.AddressTLS)
if autocertManager != nil {
config.TLSConfig = &tls.Config{
GetCertificate: autocertManager.GetCertificate,
}
}
}
rtmpserver, err := rtmp.New(config)