app

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package app is the public composition root for led. It wires config, the database, auth, the core API, the short-link redirector and the embedded dashboard into one HTTP server — and lets external (Pro) modules extend it through the plugin package without forking.

This is the importable seam of the Core-as-Library split: the open-core binary (cmd in this repo) calls New().Run() with no plugins; the private led-core consumer calls Use() for each Pro plugin before Run().

AutoMigrate timing: New() opens the database but does NOT migrate. Run() collects core models plus every registered plugin's Models() and migrates them together, exactly once, before any request is served.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App holds the wired core dependencies and any registered plugins.

func New

func New() (*App, error)

New loads configuration and opens the database (without migrating). Call Use to register plugins, then Run.

func (*App) DB

func (a *App) DB() *gorm.DB

DB exposes the shared database handle (useful for plugin construction).

func (*App) Run

func (a *App) Run(ctx context.Context) error

Run migrates the schema (core + plugin models), builds the HTTP server, and serves until interrupted.

func (*App) Use

func (a *App) Use(p plugin.Plugin)

Use registers a plugin. All plugins must be registered before Run so their models are migrated and their routes mounted.

Jump to

Keyboard shortcuts

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