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

42 lines
745 B
Go
Raw Normal View History

2020-01-13 21:05:38 +13:00
package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
2021-10-06 09:38:24 +13:00
"m1k1o/neko"
"m1k1o/neko/internal/types/config"
2020-01-13 21:05:38 +13:00
)
func init() {
command := &cobra.Command{
Use: "serve",
2020-01-19 12:30:09 +13:00
Short: "serve neko streaming server",
Long: `serve neko streaming server`,
2020-01-13 21:05:38 +13:00
Run: neko.Service.ServeCommand,
}
configs := []config.Config{
2020-01-19 12:30:09 +13:00
neko.Service.Server,
neko.Service.WebRTC,
2020-04-06 10:34:51 +12:00
neko.Service.Remote,
neko.Service.Broadcast,
2020-01-19 12:30:09 +13:00
neko.Service.WebSocket,
2020-01-13 21:05:38 +13:00
}
cobra.OnInitialize(func() {
for _, cfg := range configs {
cfg.Set()
}
neko.Service.Preflight()
})
for _, cfg := range configs {
if err := cfg.Init(command); err != nil {
2020-01-19 12:30:09 +13:00
log.Panic().Err(err).Msg("unable to run serve command")
2020-01-13 21:05:38 +13:00
}
}
root.AddCommand(command)
}