Fix panics if cluster is not enabled

This commit is contained in:
Ingo Oppermann
2023-05-05 11:56:39 +02:00
parent bd46d13bcf
commit cd58cf3df7
2 changed files with 12 additions and 4 deletions

View File

@@ -948,7 +948,10 @@ func (a *api) start() error {
Token: cfg.RTMP.Token, Token: cfg.RTMP.Token,
Logger: a.log.logger.rtmp, Logger: a.log.logger.rtmp,
Collector: a.sessions.Collector("rtmp"), Collector: a.sessions.Collector("rtmp"),
Proxy: a.cluster.ProxyReader(), }
if a.cluster != nil {
config.Proxy = a.cluster.ProxyReader()
} }
if cfg.RTMP.EnableTLS { if cfg.RTMP.EnableTLS {
@@ -977,7 +980,10 @@ func (a *api) start() error {
Token: cfg.SRT.Token, Token: cfg.SRT.Token,
Logger: a.log.logger.core.WithComponent("SRT").WithField("address", cfg.SRT.Address), Logger: a.log.logger.core.WithComponent("SRT").WithField("address", cfg.SRT.Address),
Collector: a.sessions.Collector("srt"), Collector: a.sessions.Collector("srt"),
Proxy: a.cluster.ProxyReader(), }
if a.cluster != nil {
config.Proxy = a.cluster.ProxyReader()
} }
if cfg.SRT.Log.Enable { if cfg.SRT.Log.Enable {

View File

@@ -194,8 +194,10 @@ func NewServer(config Config) (Server, error) {
corsPrefixes[httpfs.Mountpoint] = config.Cors.Origins corsPrefixes[httpfs.Mountpoint] = config.Cors.Origins
if httpfs.Filesystem.Type() == "disk" || httpfs.Filesystem.Type() == "mem" { if config.Cluster != nil {
httpfs.Filesystem = fs.NewClusterFS(httpfs.Filesystem.Name(), httpfs.Filesystem, config.Cluster.ProxyReader()) if httpfs.Filesystem.Type() == "disk" || httpfs.Filesystem.Type() == "mem" {
httpfs.Filesystem = fs.NewClusterFS(httpfs.Filesystem.Name(), httpfs.Filesystem, config.Cluster.ProxyReader())
}
} }
filesystem := &filesystem{ filesystem := &filesystem{