bootstrap

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 74 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine is the main entry point for doc-assembly. Create with New(), register extensions, then call Run().

func New

func New() *Engine

New creates a new Engine with default configuration.

func NewWithConfig

func NewWithConfig(configPath string) *Engine

NewWithConfig creates a new Engine that loads config from the given file path.

func (*Engine) GetProcessResolver

func (e *Engine) GetProcessResolver() port.ProcessResolver

GetProcessResolver returns the registered process resolver.

func (*Engine) GetPublicDocumentAccessAuthenticator

func (e *Engine) GetPublicDocumentAccessAuthenticator() port.PublicDocumentAccessAuthenticator

GetPublicDocumentAccessAuthenticator returns the registered public access authenticator, or nil if not set.

func (*Engine) GetSigningSessionAuthenticator

func (e *Engine) GetSigningSessionAuthenticator() port.SigningSessionAuthenticator

GetSigningSessionAuthenticator returns the registered signing session authenticator, or nil if not set.

func (*Engine) GetTemplateResolver

func (e *Engine) GetTemplateResolver() port.TemplateResolver

GetTemplateResolver returns the registered custom template resolver.

func (*Engine) OnDocumentCompleted

func (e *Engine) OnDocumentCompleted(fn port.DocumentCompletedHandler) *Engine

OnDocumentCompleted registers a handler that is called when a document reaches COMPLETED status. The handler runs inside a River job worker, so returning an error causes automatic retry with backoff.

func (*Engine) OnShutdown

func (e *Engine) OnShutdown(fn func(ctx context.Context) error) *Engine

OnShutdown registers a hook that runs AFTER HTTP server stops, BEFORE exit. Hooks run synchronously in REVERSE registration order (LIFO).

func (*Engine) OnStart

func (e *Engine) OnStart(fn func(ctx context.Context) error) *Engine

OnStart registers a hook that runs AFTER config/preflight, BEFORE HTTP server starts. Hooks run synchronously in registration order.

func (*Engine) RegisterInjector

func (e *Engine) RegisterInjector(inj port.Injector) *Engine

RegisterInjector adds a custom injector to the engine. Multiple injectors can be registered.

func (*Engine) Run

func (e *Engine) Run() error

Run starts the engine: loads config, runs preflight checks, initializes all components, and starts the HTTP server. Blocks until shutdown signal (SIGINT/SIGTERM).

func (*Engine) RunMigrations

func (e *Engine) RunMigrations() error

RunMigrations loads config and applies all pending database migrations.

func (*Engine) SetDesignTokens

func (e *Engine) SetDesignTokens(tokens pdfrenderer.TypstDesignTokens) *Engine

SetDesignTokens sets custom design tokens for PDF rendering. Controls fonts, colors, spacing, and heading styles in Typst output. If not set, DefaultDesignTokens() is used.

func (*Engine) SetFrontendFS

func (e *Engine) SetFrontendFS(fsys fs.FS) *Engine

SetFrontendFS overrides the embedded frontend filesystem. By default, the engine loads the embedded SPA from internal/frontend/dist. Pass a custom fs.FS to serve a different frontend, or nil to disable frontend serving.

func (*Engine) SetI18nFilePath

func (e *Engine) SetI18nFilePath(path string) *Engine

SetI18nFilePath sets the path to user-provided i18n translations file.

func (*Engine) SetInitFunc

func (e *Engine) SetInitFunc(fn port.InitFunc) *Engine

SetInitFunc sets the global initialization function. Runs once before all injectors on each render request.

func (*Engine) SetMapper

func (e *Engine) SetMapper(m port.RequestMapper) *Engine

SetMapper sets the request mapper for render requests. Only ONE mapper is supported.

func (*Engine) SetNotificationProvider

func (e *Engine) SetNotificationProvider(np port.NotificationProvider) *Engine

SetNotificationProvider overrides the notification provider. Default: auto-selected from config (noop/smtp/gmail).

func (*Engine) SetProcessResolver

func (e *Engine) SetProcessResolver(r port.ProcessResolver) *Engine

SetProcessResolver sets an optional process resolver for process validation and discovery.

func (*Engine) SetPublicDocumentAccessAuthenticator

func (e *Engine) SetPublicDocumentAccessAuthenticator(auth port.PublicDocumentAccessAuthenticator) *Engine

SetPublicDocumentAccessAuthenticator sets custom authentication for /public/doc/:documentId. When auth succeeds, the request can bypass the email gate and be redirected directly to a tokenized /public/sign/:token URL.

func (*Engine) SetSigningProvider

func (e *Engine) SetSigningProvider(sp port.SigningProvider) *Engine

SetSigningProvider overrides the signing provider. Default: auto-selected from config (mock/documenso).

func (*Engine) SetSigningSessionAuthMode

func (e *Engine) SetSigningSessionAuthMode(mode string) *Engine

SetSigningSessionAuthMode overrides signing session auth mode configured via settings/app.yaml (signing_session_auth.mode).

func (*Engine) SetSigningSessionAuthenticator

func (e *Engine) SetSigningSessionAuthenticator(auth port.SigningSessionAuthenticator) *Engine

SetSigningSessionAuthenticator sets custom authentication for /api/v1/signing-sessions/:documentId when mode is "custom".

func (*Engine) SetStorageAdapter

func (e *Engine) SetStorageAdapter(sa port.StorageAdapter) *Engine

SetStorageAdapter overrides the storage adapter. Default: auto-selected from config (local/s3).

func (*Engine) SetTemplateResolver

func (e *Engine) SetTemplateResolver(r port.TemplateResolver) *Engine

SetTemplateResolver sets an optional custom template resolver for internal create flow.

func (*Engine) SetWebhookHandlers

func (e *Engine) SetWebhookHandlers(handlers map[string]port.WebhookHandler) *Engine

SetWebhookHandlers overrides the webhook handlers by provider name. Default: auto-selected from signing config.

func (*Engine) SetWorkspaceInjectableProvider

func (e *Engine) SetWorkspaceInjectableProvider(p port.WorkspaceInjectableProvider) *Engine

SetWorkspaceInjectableProvider sets the provider for workspace-specific injectables.

func (*Engine) UseAPIMiddleware

func (e *Engine) UseAPIMiddleware(mw gin.HandlerFunc) *Engine

UseAPIMiddleware adds middleware to /api/v1/* routes only. Execution order: Operation -> Auth -> Identity -> Roles -> [User API Middleware] -> Controller

func (*Engine) UseMiddleware

func (e *Engine) UseMiddleware(mw gin.HandlerFunc) *Engine

UseMiddleware adds middleware to be applied globally to all routes. Execution order: Recovery -> Logger -> CORS -> [User Global Middleware] -> Routes

Jump to

Keyboard shortcuts

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