2022-09-25 22:16:21 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-10-25 19:03:23 -04:00
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/rs/zerolog"
|
|
|
|
"github.com/rs/zerolog/log"
|
2022-09-25 22:16:21 -04:00
|
|
|
|
|
|
|
"dynatron.me/x/blasphem/internal/common"
|
2022-12-20 13:54:49 -05:00
|
|
|
"dynatron.me/x/blasphem/pkg/blas"
|
2022-09-25 22:16:21 -04:00
|
|
|
"dynatron.me/x/blasphem/pkg/cmd/serve"
|
|
|
|
"dynatron.me/x/blasphem/pkg/config"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2022-10-25 19:03:23 -04:00
|
|
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
|
|
|
|
2022-09-25 22:16:21 -04:00
|
|
|
rootCmd := cobra.Command{
|
|
|
|
Use: common.AppName,
|
|
|
|
}
|
|
|
|
|
|
|
|
config, err := config.ReadConfig()
|
|
|
|
if err != nil {
|
2022-10-25 19:03:23 -04:00
|
|
|
log.Fatal().Err(err).Msg("Config read failed")
|
2022-09-25 22:16:21 -04:00
|
|
|
}
|
|
|
|
|
2022-12-20 13:54:49 -05:00
|
|
|
bl, err := blas.New(config)
|
2022-12-20 13:16:30 -05:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal().Err(err).Msg("Core create failed")
|
|
|
|
}
|
|
|
|
|
|
|
|
rootCmd.AddCommand(serve.Command(bl))
|
2022-09-25 22:16:21 -04:00
|
|
|
|
|
|
|
err = rootCmd.Execute()
|
|
|
|
if err != nil {
|
2022-10-25 19:03:23 -04:00
|
|
|
log.Fatal().Err(err).Msg("Dying")
|
2022-09-25 22:16:21 -04:00
|
|
|
}
|
|
|
|
}
|