cmd

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2025 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DB_URL     = "sqlite3://resources/data/gowlive.db"
	SOURCE_URL = "file://manifest/migrate"
)

Variables

View Source
var (
	Main = gcmd.Command{
		Name:  "main",
		Usage: "main",
		Brief: "Gowlive backend api",
		Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
			g.Log().Info(ctx, "Starting HTTP Server...")
			gfToken, err := GetGtoken(ctx)
			if err != nil {
				g.Log().Error(ctx, err)
				return err
			}
			initDir()
			s := g.Server()
			s.SetGraceful(true)
			s.SetIndexFolder(true)
			s.SetServerRoot(utils.DATA_PATH)
			s.AddSearchPath(utils.DATA_PATH)
			s.SetSwaggerUITemplate(consts.MySwaggerUITemplate)
			s.Use(service.Middleware().HandlerResponse)
			s.Group("/", func(group *ghttp.RouterGroup) {
				group.Middleware(
					service.Middleware().Ctx,
					ghttp.MiddlewareCORS,
				)
				group.Group("/", func(group *ghttp.RouterGroup) {
					err = gfToken.Middleware(ctx, group)
					if err != nil {
						panic(err)
					}
					group.ALL("/sse", sse.HandleSSE)
					bindRoute(group)
				})
			})
			JobInit()
			LiveMonitor()
			s.Run()
			go func() {
				gproc.AddSigHandlerShutdown(shutdown)
				gproc.Listen()
			}()
			return nil
		},
	}
)

Functions

func AuthAfterFunc

func AuthAfterFunc(r *ghttp.Request, respData gtoken.Resp)

func GetGtoken

func GetGtoken(ctx context.Context) (gfToken *gtoken.GfToken, err error)

func JobInit

func JobInit()

func LiveMonitor

func LiveMonitor()

func LoginFunc

func LoginFunc(r *ghttp.Request) (string, interface{})

func LogoutAfterFunc

func LogoutAfterFunc(r *ghttp.Request, respData gtoken.Resp)

func Migrate

func Migrate() (err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL