package boot import ( "context" "github.com/EQEmuTools/spire/internal/database" "github.com/EQEmuTools/spire/internal/desktop" "github.com/EQEmuTools/spire/internal/eqemuserver" "github.com/EQEmuTools/spire/internal/http/routes" "github.com/EQEmuTools/spire/internal/spire" gocache "github.com/patrickmn/go-cache" "github.com/spf13/cobra" "gorm.io/gorm" ) // App is the root App resource type App struct { context context.Context mysql *gorm.DB dbConnections *database.Connections cache *gocache.Cache commands []*cobra.Command db *database.Resolver router *routes.Router desktop *desktop.WebBoot onboarding *spire.Init watcher *eqemuserver.QuestHotReloadWatcher } func (a App) Cache() *gocache.Cache { return a.cache } func (a App) Desktop() *desktop.WebBoot { return a.desktop } func (a App) DbConnections() *database.Connections { return a.dbConnections } func (a App) Commands() []*cobra.Command { return a.commands } // Create new App func NewApplication( mysql *gorm.DB, cache *gocache.Cache, commands []*cobra.Command, db *database.Resolver, dbConnections *database.Connections, router *routes.Router, desktop *desktop.WebBoot, onboarding *spire.Init, ) App { return App{ context: context.Background(), mysql: mysql, cache: cache, commands: commands, db: db, dbConnections: dbConnections, router: router, desktop: desktop, onboarding: onboarding, } }