add V2: prefix to all config options.

This commit is contained in:
Miroslav Šedivý 2024-07-18 21:54:53 +02:00
parent 03733a9cd3
commit 35edeb94b2
7 changed files with 35 additions and 35 deletions

View File

@ -186,12 +186,12 @@ func (Capture) Init(cmd *cobra.Command) error {
} }
func (Capture) InitV2(cmd *cobra.Command) error { func (Capture) InitV2(cmd *cobra.Command) error {
cmd.PersistentFlags().String("display", "", "XDisplay to capture") cmd.PersistentFlags().String("display", "", "V2: XDisplay to capture")
if err := viper.BindPFlag("display", cmd.PersistentFlags().Lookup("display")); err != nil { if err := viper.BindPFlag("display", cmd.PersistentFlags().Lookup("display")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("video_codec", "", "video codec to be used") cmd.PersistentFlags().String("video_codec", "", "V2: video codec to be used")
if err := viper.BindPFlag("video_codec", cmd.PersistentFlags().Lookup("video_codec")); err != nil { if err := viper.BindPFlag("video_codec", cmd.PersistentFlags().Lookup("video_codec")); err != nil {
return err return err
} }
@ -220,22 +220,22 @@ func (Capture) InitV2(cmd *cobra.Command) error {
return err return err
} }
cmd.PersistentFlags().String("hwenc", "", "use hardware accelerated encoding") cmd.PersistentFlags().String("hwenc", "", "V2: use hardware accelerated encoding")
if err := viper.BindPFlag("hwenc", cmd.PersistentFlags().Lookup("hwenc")); err != nil { if err := viper.BindPFlag("hwenc", cmd.PersistentFlags().Lookup("hwenc")); err != nil {
return err return err
} }
cmd.PersistentFlags().Int("video_bitrate", 0, "video bitrate in kbit/s") cmd.PersistentFlags().Int("video_bitrate", 0, "V2: video bitrate in kbit/s")
if err := viper.BindPFlag("video_bitrate", cmd.PersistentFlags().Lookup("video_bitrate")); err != nil { if err := viper.BindPFlag("video_bitrate", cmd.PersistentFlags().Lookup("video_bitrate")); err != nil {
return err return err
} }
cmd.PersistentFlags().Int("max_fps", 0, "maximum fps delivered via WebRTC, 0 is for no maximum") cmd.PersistentFlags().Int("max_fps", 0, "V2: maximum fps delivered via WebRTC, 0 is for no maximum")
if err := viper.BindPFlag("max_fps", cmd.PersistentFlags().Lookup("max_fps")); err != nil { if err := viper.BindPFlag("max_fps", cmd.PersistentFlags().Lookup("max_fps")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("video", "", "video codec parameters to use for streaming") cmd.PersistentFlags().String("video", "", "V2: video codec parameters to use for streaming")
if err := viper.BindPFlag("video", cmd.PersistentFlags().Lookup("video")); err != nil { if err := viper.BindPFlag("video", cmd.PersistentFlags().Lookup("video")); err != nil {
return err return err
} }
@ -244,12 +244,12 @@ func (Capture) InitV2(cmd *cobra.Command) error {
// audio // audio
// //
cmd.PersistentFlags().String("device", "", "audio device to capture") cmd.PersistentFlags().String("device", "", "V2: audio device to capture")
if err := viper.BindPFlag("device", cmd.PersistentFlags().Lookup("device")); err != nil { if err := viper.BindPFlag("device", cmd.PersistentFlags().Lookup("device")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("audio_codec", "", "audio codec to be used") cmd.PersistentFlags().String("audio_codec", "", "V2: audio codec to be used")
if err := viper.BindPFlag("audio_codec", cmd.PersistentFlags().Lookup("audio_codec")); err != nil { if err := viper.BindPFlag("audio_codec", cmd.PersistentFlags().Lookup("audio_codec")); err != nil {
return err return err
} }
@ -279,12 +279,12 @@ func (Capture) InitV2(cmd *cobra.Command) error {
} }
// audio codecs // audio codecs
cmd.PersistentFlags().Int("audio_bitrate", 0, "audio bitrate in kbit/s") cmd.PersistentFlags().Int("audio_bitrate", 0, "V2: audio bitrate in kbit/s")
if err := viper.BindPFlag("audio_bitrate", cmd.PersistentFlags().Lookup("audio_bitrate")); err != nil { if err := viper.BindPFlag("audio_bitrate", cmd.PersistentFlags().Lookup("audio_bitrate")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("audio", "", "audio codec parameters to use for streaming") cmd.PersistentFlags().String("audio", "", "V2: audio codec parameters to use for streaming")
if err := viper.BindPFlag("audio", cmd.PersistentFlags().Lookup("audio")); err != nil { if err := viper.BindPFlag("audio", cmd.PersistentFlags().Lookup("audio")); err != nil {
return err return err
} }
@ -293,17 +293,17 @@ func (Capture) InitV2(cmd *cobra.Command) error {
// broadcast // broadcast
// //
cmd.PersistentFlags().String("broadcast_pipeline", "", "custom gst pipeline used for broadcasting, strings {url} {device} {display} will be replaced") cmd.PersistentFlags().String("broadcast_pipeline", "", "V2: custom gst pipeline used for broadcasting, strings {url} {device} {display} will be replaced")
if err := viper.BindPFlag("broadcast_pipeline", cmd.PersistentFlags().Lookup("broadcast_pipeline")); err != nil { if err := viper.BindPFlag("broadcast_pipeline", cmd.PersistentFlags().Lookup("broadcast_pipeline")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("broadcast_url", "", "a default default URL for broadcast streams, can be disabled/changed later by admins in the GUI") cmd.PersistentFlags().String("broadcast_url", "", "V2: a default default URL for broadcast streams, can be disabled/changed later by admins in the GUI")
if err := viper.BindPFlag("broadcast_url", cmd.PersistentFlags().Lookup("broadcast_url")); err != nil { if err := viper.BindPFlag("broadcast_url", cmd.PersistentFlags().Lookup("broadcast_url")); err != nil {
return err return err
} }
cmd.PersistentFlags().Bool("broadcast_autostart", false, "automatically start broadcasting when neko starts and broadcast_url is set") cmd.PersistentFlags().Bool("broadcast_autostart", false, "V2: automatically start broadcasting when neko starts and broadcast_url is set")
if err := viper.BindPFlag("broadcast_autostart", cmd.PersistentFlags().Lookup("broadcast_autostart")); err != nil { if err := viper.BindPFlag("broadcast_autostart", cmd.PersistentFlags().Lookup("broadcast_autostart")); err != nil {
return err return err
} }

View File

@ -65,7 +65,7 @@ func (Desktop) Init(cmd *cobra.Command) error {
} }
func (Desktop) InitV2(cmd *cobra.Command) error { func (Desktop) InitV2(cmd *cobra.Command) error {
cmd.PersistentFlags().String("screen", "", "default screen resolution and framerate") cmd.PersistentFlags().String("screen", "", "V2: default screen resolution and framerate")
if err := viper.BindPFlag("screen", cmd.PersistentFlags().Lookup("screen")); err != nil { if err := viper.BindPFlag("screen", cmd.PersistentFlags().Lookup("screen")); err != nil {
return err return err
} }

View File

@ -69,12 +69,12 @@ func (Member) Init(cmd *cobra.Command) error {
} }
func (Member) InitV2(cmd *cobra.Command) error { func (Member) InitV2(cmd *cobra.Command) error {
cmd.PersistentFlags().String("password", "", "password for connecting to stream") cmd.PersistentFlags().String("password", "", "V2: password for connecting to stream")
if err := viper.BindPFlag("password", cmd.PersistentFlags().Lookup("password")); err != nil { if err := viper.BindPFlag("password", cmd.PersistentFlags().Lookup("password")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("password_admin", "", "admin password for connecting to stream") cmd.PersistentFlags().String("password_admin", "", "V2: admin password for connecting to stream")
if err := viper.BindPFlag("password_admin", cmd.PersistentFlags().Lookup("password_admin")); err != nil { if err := viper.BindPFlag("password_admin", cmd.PersistentFlags().Lookup("password_admin")); err != nil {
return err return err
} }

View File

@ -62,7 +62,7 @@ func (Root) Init(cmd *cobra.Command) error {
} }
func (Root) InitV2(cmd *cobra.Command) error { func (Root) InitV2(cmd *cobra.Command) error {
cmd.PersistentFlags().BoolP("logs", "l", false, "save logs to file") cmd.PersistentFlags().BoolP("logs", "l", false, "V2: save logs to file")
if err := viper.BindPFlag("logs", cmd.PersistentFlags().Lookup("logs")); err != nil { if err := viper.BindPFlag("logs", cmd.PersistentFlags().Lookup("logs")); err != nil {
return err return err
} }

View File

@ -72,37 +72,37 @@ func (Server) Init(cmd *cobra.Command) error {
} }
func (Server) InitV2(cmd *cobra.Command) error { func (Server) InitV2(cmd *cobra.Command) error {
cmd.PersistentFlags().String("bind", "", "address/port/socket to serve neko") cmd.PersistentFlags().String("bind", "", "V2: address/port/socket to serve neko")
if err := viper.BindPFlag("bind", cmd.PersistentFlags().Lookup("bind")); err != nil { if err := viper.BindPFlag("bind", cmd.PersistentFlags().Lookup("bind")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("cert", "", "path to the SSL cert used to secure the neko server") cmd.PersistentFlags().String("cert", "", "V2: path to the SSL cert used to secure the neko server")
if err := viper.BindPFlag("cert", cmd.PersistentFlags().Lookup("cert")); err != nil { if err := viper.BindPFlag("cert", cmd.PersistentFlags().Lookup("cert")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("key", "", "path to the SSL key used to secure the neko server") cmd.PersistentFlags().String("key", "", "V2: path to the SSL key used to secure the neko server")
if err := viper.BindPFlag("key", cmd.PersistentFlags().Lookup("key")); err != nil { if err := viper.BindPFlag("key", cmd.PersistentFlags().Lookup("key")); err != nil {
return err return err
} }
cmd.PersistentFlags().Bool("proxy", false, "enable reverse proxy mode") cmd.PersistentFlags().Bool("proxy", false, "V2: enable reverse proxy mode")
if err := viper.BindPFlag("proxy", cmd.PersistentFlags().Lookup("proxy")); err != nil { if err := viper.BindPFlag("proxy", cmd.PersistentFlags().Lookup("proxy")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("static", "", "path to neko client files to serve") cmd.PersistentFlags().String("static", "", "V2: path to neko client files to serve")
if err := viper.BindPFlag("static", cmd.PersistentFlags().Lookup("static")); err != nil { if err := viper.BindPFlag("static", cmd.PersistentFlags().Lookup("static")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("path_prefix", "", "path prefix for HTTP requests") cmd.PersistentFlags().String("path_prefix", "", "V2: path prefix for HTTP requests")
if err := viper.BindPFlag("path_prefix", cmd.PersistentFlags().Lookup("path_prefix")); err != nil { if err := viper.BindPFlag("path_prefix", cmd.PersistentFlags().Lookup("path_prefix")); err != nil {
return err return err
} }
cmd.PersistentFlags().StringSlice("cors", []string{}, "list of allowed origins for CORS") cmd.PersistentFlags().StringSlice("cors", []string{}, "V2: list of allowed origins for CORS")
if err := viper.BindPFlag("cors", cmd.PersistentFlags().Lookup("cors")); err != nil { if err := viper.BindPFlag("cors", cmd.PersistentFlags().Lookup("cors")); err != nil {
return err return err
} }

View File

@ -97,17 +97,17 @@ func (Session) Init(cmd *cobra.Command) error {
} }
func (Session) InitV2(cmd *cobra.Command) error { func (Session) InitV2(cmd *cobra.Command) error {
cmd.PersistentFlags().StringSlice("locks", []string{}, "resources, that will be locked when starting (control, login)") cmd.PersistentFlags().StringSlice("locks", []string{}, "V2: resources, that will be locked when starting (control, login)")
if err := viper.BindPFlag("locks", cmd.PersistentFlags().Lookup("locks")); err != nil { if err := viper.BindPFlag("locks", cmd.PersistentFlags().Lookup("locks")); err != nil {
return err return err
} }
cmd.PersistentFlags().Bool("control_protection", false, "control protection means, users can gain control only if at least one admin is in the room") cmd.PersistentFlags().Bool("control_protection", false, "V2: control protection means, users can gain control only if at least one admin is in the room")
if err := viper.BindPFlag("control_protection", cmd.PersistentFlags().Lookup("control_protection")); err != nil { if err := viper.BindPFlag("control_protection", cmd.PersistentFlags().Lookup("control_protection")); err != nil {
return err return err
} }
cmd.PersistentFlags().Bool("implicit_control", false, "if enabled members can gain control implicitly") cmd.PersistentFlags().Bool("implicit_control", false, "V2: if enabled members can gain control implicitly")
if err := viper.BindPFlag("implicit_control", cmd.PersistentFlags().Lookup("implicit_control")); err != nil { if err := viper.BindPFlag("implicit_control", cmd.PersistentFlags().Lookup("implicit_control")); err != nil {
return err return err
} }

View File

@ -168,42 +168,42 @@ func (WebRTC) Init(cmd *cobra.Command) error {
} }
func (WebRTC) InitV2(cmd *cobra.Command) error { func (WebRTC) InitV2(cmd *cobra.Command) error {
cmd.PersistentFlags().String("epr", "", "limits the pool of ephemeral ports that ICE UDP connections can allocate from") cmd.PersistentFlags().String("epr", "", "V2: limits the pool of ephemeral ports that ICE UDP connections can allocate from")
if err := viper.BindPFlag("epr", cmd.PersistentFlags().Lookup("epr")); err != nil { if err := viper.BindPFlag("epr", cmd.PersistentFlags().Lookup("epr")); err != nil {
return err return err
} }
cmd.PersistentFlags().StringSlice("nat1to1", []string{}, "sets a list of external IP addresses of 1:1 (D)NAT and a candidate type for which the external IP address is used") cmd.PersistentFlags().StringSlice("nat1to1", []string{}, "V2: sets a list of external IP addresses of 1:1 (D)NAT and a candidate type for which the external IP address is used")
if err := viper.BindPFlag("nat1to1", cmd.PersistentFlags().Lookup("nat1to1")); err != nil { if err := viper.BindPFlag("nat1to1", cmd.PersistentFlags().Lookup("nat1to1")); err != nil {
return err return err
} }
cmd.PersistentFlags().Int("tcpmux", 0, "single TCP mux port for all peers") cmd.PersistentFlags().Int("tcpmux", 0, "V2: single TCP mux port for all peers")
if err := viper.BindPFlag("tcpmux", cmd.PersistentFlags().Lookup("tcpmux")); err != nil { if err := viper.BindPFlag("tcpmux", cmd.PersistentFlags().Lookup("tcpmux")); err != nil {
return err return err
} }
cmd.PersistentFlags().Int("udpmux", 0, "single UDP mux port for all peers") cmd.PersistentFlags().Int("udpmux", 0, "V2: single UDP mux port for all peers")
if err := viper.BindPFlag("udpmux", cmd.PersistentFlags().Lookup("udpmux")); err != nil { if err := viper.BindPFlag("udpmux", cmd.PersistentFlags().Lookup("udpmux")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("ipfetch", "", "automatically fetch IP address from given URL when nat1to1 is not present") cmd.PersistentFlags().String("ipfetch", "", "V2: automatically fetch IP address from given URL when nat1to1 is not present")
if err := viper.BindPFlag("ipfetch", cmd.PersistentFlags().Lookup("ipfetch")); err != nil { if err := viper.BindPFlag("ipfetch", cmd.PersistentFlags().Lookup("ipfetch")); err != nil {
return err return err
} }
cmd.PersistentFlags().Bool("icelite", false, "configures whether or not the ice agent should be a lite agent") cmd.PersistentFlags().Bool("icelite", false, "V2: configures whether or not the ice agent should be a lite agent")
if err := viper.BindPFlag("icelite", cmd.PersistentFlags().Lookup("icelite")); err != nil { if err := viper.BindPFlag("icelite", cmd.PersistentFlags().Lookup("icelite")); err != nil {
return err return err
} }
cmd.PersistentFlags().StringSlice("iceserver", []string{}, "describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer") cmd.PersistentFlags().StringSlice("iceserver", []string{}, "V2: describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer")
if err := viper.BindPFlag("iceserver", cmd.PersistentFlags().Lookup("iceserver")); err != nil { if err := viper.BindPFlag("iceserver", cmd.PersistentFlags().Lookup("iceserver")); err != nil {
return err return err
} }
cmd.PersistentFlags().String("iceservers", "", "describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer") cmd.PersistentFlags().String("iceservers", "", "V2: describes a single STUN and TURN server that can be used by the ICEAgent to establish a connection with a peer")
if err := viper.BindPFlag("iceservers", cmd.PersistentFlags().Lookup("iceservers")); err != nil { if err := viper.BindPFlag("iceservers", cmd.PersistentFlags().Lookup("iceservers")); err != nil {
return err return err
} }