mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
Feature: default broadcast endpoint config option (#123)
* feat: add broadcast_default_endpoint config * chore: add documentation for new env variable * rename to broadcast URL. * update changelog. Co-authored-by: Miroslav Šedivý <sedivy.miro@gmail.com>
This commit is contained in:
committed by
GitHub
parent
f37a2347e1
commit
50a85c6b39
@ -25,8 +25,8 @@ func New(remote *config.Remote, config *config.Broadcast) *BroadcastManager {
|
||||
logger: log.With().Str("module", "remote").Logger(),
|
||||
remote: remote,
|
||||
config: config,
|
||||
enabled: false,
|
||||
url: "",
|
||||
enabled: config.Enabled,
|
||||
url: config.URL,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@ import (
|
||||
|
||||
type Broadcast struct {
|
||||
Pipeline string
|
||||
URL string
|
||||
Enabled bool
|
||||
}
|
||||
|
||||
func (Broadcast) Init(cmd *cobra.Command) error {
|
||||
@ -15,9 +17,16 @@ func (Broadcast) Init(cmd *cobra.Command) error {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().String("broadcast_url", "", "URL for broadcasting, setting this value will automatically enable broadcasting")
|
||||
if err := viper.BindPFlag("broadcast_url", cmd.PersistentFlags().Lookup("broadcast_url")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Broadcast) Set() {
|
||||
s.Pipeline = viper.GetString("broadcast_pipeline")
|
||||
s.URL = viper.GetString("broadcast_url")
|
||||
s.Enabled = s.URL != ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user