mirror of
https://github.com/m1k1o/neko.git
synced 2025-05-29 08:57:09 +02:00
initial commit - from neko open source repository..
This commit is contained in:
commit
56de805f54
66 changed files with 5498 additions and 0 deletions
41
cmd/serve.go
Normal file
41
cmd/serve.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"n.eko.moe/neko"
|
||||
"n.eko.moe/neko/internal/types/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.Remote,
|
||||
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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue