mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 16:07:07 +08:00
Add basic node handling
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/datarhei/core/v16/app"
|
||||
"github.com/datarhei/core/v16/cluster"
|
||||
"github.com/datarhei/core/v16/config"
|
||||
"github.com/datarhei/core/v16/ffmpeg"
|
||||
"github.com/datarhei/core/v16/http"
|
||||
@@ -77,6 +78,7 @@ type api struct {
|
||||
httpjwt jwt.JWT
|
||||
update update.Checker
|
||||
replacer replace.Replacer
|
||||
cluster cluster.Cluster
|
||||
|
||||
errorChan chan error
|
||||
|
||||
@@ -495,6 +497,14 @@ func (a *api) start() error {
|
||||
|
||||
a.restream = restream
|
||||
|
||||
if cluster, err := cluster.New(cluster.ClusterConfig{
|
||||
Logger: a.log.logger.core.WithComponent("Cluster"),
|
||||
}); err != nil {
|
||||
return fmt.Errorf("unable to create cluster: %w", err)
|
||||
} else {
|
||||
a.cluster = cluster
|
||||
}
|
||||
|
||||
var httpjwt jwt.JWT
|
||||
|
||||
if cfg.API.Auth.Enable {
|
||||
@@ -818,6 +828,7 @@ func (a *api) start() error {
|
||||
Sessions: a.sessions,
|
||||
Router: router,
|
||||
ReadOnly: cfg.API.ReadOnly,
|
||||
Cluster: a.cluster,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@@ -880,6 +891,7 @@ func (a *api) start() error {
|
||||
Sessions: a.sessions,
|
||||
Router: router,
|
||||
ReadOnly: cfg.API.ReadOnly,
|
||||
Cluster: a.cluster,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@@ -1112,6 +1124,10 @@ func (a *api) stop() {
|
||||
return
|
||||
}
|
||||
|
||||
if a.cluster != nil {
|
||||
a.cluster.Stop()
|
||||
}
|
||||
|
||||
// Stop JWT authentication
|
||||
if a.httpjwt != nil {
|
||||
a.httpjwt.ClearValidators()
|
||||
|
Reference in New Issue
Block a user