bootstrap

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: GPL-3.0 Imports: 37 Imported by: 0

Documentation

Overview

Package bootstrap 提供应用启动引导功能 负责初始化核心服务和加载所有模块

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	DB *gorm.DB

	Config       *config.Config
	EventBus     *event.Bus
	Registry     *module.Registry
	Logger       *zap.Logger
	Router       *gin.Engine
	TokenManager *auth.TokenManager

	// 核心模块快捷访问
	Setup        *setup.Module
	Users        *users.Module
	Files        *files.Module
	System       *system.Module
	Notification *notification.Module
	Sudo         *sudo.Module
	Terminal     *terminal.Module
	Docker       *docker.Module
	Samba        *samba.Module
	SSH          *ssh.Module
	Sync         *sync.Module
	Download     *download.Module
	Flatpak      *flatpak.Module
	Windows      *windows.Module
	Packages     *packages.Module
	Retrogame    *retrogame.Module
	Photos       *photos.Module
	Video        *video.Module
	Backup       *backup.Module
	Premium      *premium.Module

	// 插件管理器
	PluginManager *plugin.Manager
	// contains filtered or unexported fields
}

App 代表应用实例

func New

func New(opts *Options) (*App, error)

New 创建并初始化应用

func (*App) GetDB

func (app *App) GetDB() *gorm.DB

GetDB 返回数据库连接

func (*App) GetFilesService

func (app *App) GetFilesService() *files.Service

GetFilesService 获取文件服务

func (*App) GetModule

func (app *App) GetModule(id string) module.Module

GetModule 根据 ID 获取模块

func (*App) GetNotificationService

func (app *App) GetNotificationService() *notification.Service

GetNotificationService 获取通知服务

func (*App) GetRouter

func (app *App) GetRouter() *gin.Engine

GetRouter 返回 Gin 路由器

func (*App) GetSystemService

func (app *App) GetSystemService() *system.Service

GetSystemService 获取系统服务

func (*App) GetUsersService

func (app *App) GetUsersService() *users.Service

GetUsersService 获取用户服务

func (*App) Start

func (app *App) Start() error

Start 启动应用

func (*App) Stop

func (app *App) Stop() error

Stop 停止应用

type Options

type Options struct {
	// DBPath 数据库文件路径
	DBPath string

	// DataDir 数据目录
	DataDir string

	// LogPath 日志路径
	LogPath string

	// Debug 是否开启调试模式
	Debug bool
}

Options 启动选项

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions 返回默认选项

Jump to

Keyboard shortcuts

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