add backend tpl

This commit is contained in:
Rogee
2024-11-28 23:18:11 +08:00
parent 77e962b668
commit f7d95418a2
86 changed files with 3229 additions and 135 deletions

43
backend_v1/main.go Normal file
View File

@@ -0,0 +1,43 @@
/*
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
*/
package main
import (
"log"
"git.ipao.vip/rogeecn/mp-qvyun/cmd"
"git.ipao.vip/rogeecn/mp-qvyun/conf"
"github.com/spf13/cobra"
)
func init() {
}
func main() {
rootCmd := &cobra.Command{
Use: "qvyun",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
if err := conf.Load(cmd.Flag("config").Value.String()); err != nil {
return err
}
if cmd.Flag("debug").Value.String() == "true" {
conf.C.Debug = true
}
return nil
},
}
rootCmd.PersistentFlags().StringP("config", "C", "", "config file")
rootCmd.PersistentFlags().BoolP("debug", "D", false, "debug mode")
cmd.CommandServe(rootCmd)
cmd.CommandMigrate(rootCmd)
err := rootCmd.Execute()
if err != nil {
log.Fatal(err)
}
}