Archived
2
0
This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
neko-custom/server/cmd/serve.go
2022-09-13 20:35:53 +02:00

43 lines
764 B
Go

package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"m1k1o/neko"
"m1k1o/neko/internal/config"
)
func init() {
command := &cobra.Command{
Use: "serve",
Short: "serve neko streaming server",
Long: `serve neko streaming server`,
Run: neko.Service.ServeCommand,
}
configs := []config.Config{
neko.Service.Server,
neko.Service.WebRTC,
neko.Service.Capture,
neko.Service.Desktop,
neko.Service.Broadcast,
neko.Service.WebSocket,
}
cobra.OnInitialize(func() {
for _, cfg := range configs {
cfg.Set()
}
neko.Service.Preflight()
})
for _, cfg := range configs {
if err := cfg.Init(command); err != nil {
log.Panic().Err(err).Msg("unable to run serve command")
}
}
root.AddCommand(command)
}