2020-10-23 03:54:50 +13:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/rs/zerolog/log"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
2020-10-29 07:15:48 +13:00
|
|
|
"demodesk/neko"
|
2020-12-13 06:37:19 +13:00
|
|
|
"demodesk/neko/modules"
|
2020-11-02 04:09:48 +13:00
|
|
|
"demodesk/neko/internal/config"
|
2020-10-23 03:54:50 +13:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
command := &cobra.Command{
|
|
|
|
Use: "serve",
|
|
|
|
Short: "serve neko streaming server",
|
|
|
|
Long: `serve neko streaming server`,
|
|
|
|
Run: neko.Service.ServeCommand,
|
|
|
|
}
|
|
|
|
|
2020-12-13 06:37:19 +13:00
|
|
|
configs := append([]config.Config{
|
2020-11-04 12:27:47 +13:00
|
|
|
neko.Service.Configs.Desktop,
|
2020-11-02 04:09:48 +13:00
|
|
|
neko.Service.Configs.Capture,
|
2020-11-01 04:40:33 +13:00
|
|
|
neko.Service.Configs.WebRTC,
|
2020-11-02 06:39:12 +13:00
|
|
|
neko.Service.Configs.Session,
|
|
|
|
neko.Service.Configs.Server,
|
2021-02-01 00:58:15 +13:00
|
|
|
}, modules.Configs()...)
|
2020-10-23 03:54:50 +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 {
|
|
|
|
log.Panic().Err(err).Msg("unable to run serve command")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
root.AddCommand(command)
|
|
|
|
}
|