Documentation
¶
Overview ¶
Package app is the public entry point for embedding artel as a library.
internal/app cannot be imported outside this module (Go's internal-package rule), so an external repo that wants to build artel from source without forking it depends on github.com/ruf-dev/artel and imports this package instead:
import "github.com/ruf-dev/artel/pkg/app"
func main() {
a, err := app.New()
if err != nil {
log.Fatal().Err(err).Msg("Failed to create application")
}
err = a.Start()
if err != nil {
log.Fatal().Err(err).Msg("Failed to start application")
}
}
The resulting binary still needs the config/ directory (or -config) next to it at runtime, same as cmd/service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App = internalapp.App
App is artel's application instance: config, data sources, network listeners, and wired services/transports. It is an alias for internal/app.App, so its exported fields and methods (Start, ...) are usable from outside this module without importing internal/app directly.
func New ¶
New builds an App: loads config, opens data sources and network listeners, wires all services/transports, and applies opts to the MoM http executor wiring. Call Start on the result to run it.
It inlines internal/app.New's sequence (InitConfig -> InitServers -> Custom.Init) rather than delegating to it, so it can set Custom.SvcOptions from opts before Custom.Init wires the services. The generated internal/app.New() (DO NOT EDIT, no args) stays authoritative for the no-option path — cmd/service still calls it — and is simply unused here. app.New() with no options is behaviourally identical to it.
type Option ¶ added in v1.0.26
type Option func(*options)
Option configures the App built by New.
func WithMcpHttpMiddleware ¶ added in v1.0.26
func WithMcpHttpMiddleware(mcp momhttp.McpName, mw momhttp.Middleware) Option
WithMcpHttpMiddleware scopes an http.RoundTripper middleware to every tool of one MoM (momhttp.McpName*, e.g. momhttp.McpNameTrello) on the MoM http executor.
func WithToolHttpMiddleware ¶ added in v1.0.26
func WithToolHttpMiddleware(tool momhttp.McpToolName, mw momhttp.Middleware) Option
WithToolHttpMiddleware scopes an http.RoundTripper middleware to a single MoM tool (a momhttp.McpToolName, e.g. momhttp.McpToolName("trello.create_card")) on the MoM http executor.