Skip to content

Commit

Permalink
refactor: add -gateway and deprecate -broadcaster (#3053)
Browse files Browse the repository at this point in the history
* refactor: add -gateway and deprecate -broadcaster

This commit adds the `gateway` flag and deprecates the `broadcaster` flag
per core team decision (details:
https://discord.com/channels/423160867534929930/1051963444598943784/1210356864643109004).

* chore: update pending changelog

---------

Co-authored-by: John | Elite Encoder <john@eliteencoder.net>
  • Loading branch information
rickstaa and eliteprox committed May 16, 2024
1 parent 7599f7f commit 19f1cf6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## vX.X

- [#3053](https://github.com/livepeer/go-livepeer/pull/3053) cli: add `-gateway` flag and deprecate `-broadcaster` flag.

### Breaking Changes 🚨🚨

### Features ⚒
Expand Down
3 changes: 2 additions & 1 deletion cmd/livepeer/livepeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ func parseLivepeerConfig() starter.LivepeerConfig {
// Transcoding:
cfg.Orchestrator = flag.Bool("orchestrator", *cfg.Orchestrator, "Set to true to be an orchestrator")
cfg.Transcoder = flag.Bool("transcoder", *cfg.Transcoder, "Set to true to be a transcoder")
cfg.Broadcaster = flag.Bool("broadcaster", *cfg.Broadcaster, "Set to true to be a broadcaster")
cfg.Gateway = flag.Bool("gateway", *cfg.Broadcaster, "Set to true to be a gateway")
cfg.Broadcaster = flag.Bool("broadcaster", *cfg.Broadcaster, "Set to true to be a broadcaster (**Deprecated**, use -gateway)")
cfg.OrchSecret = flag.String("orchSecret", *cfg.OrchSecret, "Shared secret with the orchestrator as a standalone transcoder or path to file")
cfg.TranscodingOptions = flag.String("transcodingOptions", *cfg.TranscodingOptions, "Transcoding options for broadcast job, or path to json config")
cfg.MaxAttempts = flag.Int("maxAttempts", *cfg.MaxAttempts, "Maximum transcode attempts")
Expand Down
8 changes: 7 additions & 1 deletion cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ type LivepeerConfig struct {
HttpIngest *bool
Orchestrator *bool
Transcoder *bool
Gateway *bool
Broadcaster *bool
OrchSecret *string
TranscodingOptions *string
Expand Down Expand Up @@ -164,6 +165,7 @@ func DefaultLivepeerConfig() LivepeerConfig {
defaultOrchestrator := false
defaultTranscoder := false
defaultBroadcaster := false
defaultGateway := false
defaultOrchSecret := ""
defaultTranscodingOptions := "P240p30fps16x9,P360p30fps16x9"
defaultMaxAttempts := 3
Expand Down Expand Up @@ -250,6 +252,7 @@ func DefaultLivepeerConfig() LivepeerConfig {
// Transcoding:
Orchestrator: &defaultOrchestrator,
Transcoder: &defaultTranscoder,
Gateway: &defaultGateway,
Broadcaster: &defaultBroadcaster,
OrchSecret: &defaultOrchSecret,
TranscodingOptions: &defaultTranscodingOptions,
Expand Down Expand Up @@ -501,6 +504,9 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) {
n.NodeType = core.TranscoderNode
} else if *cfg.Broadcaster {
n.NodeType = core.BroadcasterNode
glog.Warning("-broadcaster flag is deprecated and will be removed in a future release. Please use -gateway instead")
} else if *cfg.Gateway {
n.NodeType = core.BroadcasterNode
} else if (cfg.Reward == nil || !*cfg.Reward) && !*cfg.InitializeRound {
exit("No services enabled; must be at least one of -broadcaster, -transcoder, -orchestrator, -redeemer, -reward or -initializeRound")
}
Expand Down Expand Up @@ -1273,7 +1279,7 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) {
case core.OrchestratorNode:
glog.Infof("***Livepeer Running in Orchestrator Mode***")
case core.BroadcasterNode:
glog.Infof("***Livepeer Running in Broadcaster Mode***")
glog.Infof("***Livepeer Running in Gateway Mode***")
glog.Infof("Video Ingest Endpoint - rtmp://%v", *cfg.RtmpAddr)
case core.TranscoderNode:
glog.Infof("**Liveepeer Running in Transcoder Mode***")
Expand Down

0 comments on commit 19f1cf6

Please sign in to comment.