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
2020-01-13 08:05:38 +00:00

38 lines
588 B
Go

package cmd
import (
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
"n.eko.moe/neko"
"n.eko.moe/neko/internal/config"
)
func init() {
command := &cobra.Command{
Use: "serve",
Short: "",
Long: ``,
Run: neko.Service.ServeCommand,
}
configs := []config.Config{
neko.Service.Serve,
}
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 command")
}
}
root.AddCommand(command)
}