function
Execute
Run the API, admin, jobs, and shutdown lifecycle.
Example
err := ridu.Execute(
content.Config(),
ridu.WithStore(func(ctx context.Context) (store.Store, error) {
return postgres.Open(ctx, os.Getenv("DATABASE_URL"))
}),
ridu.WithAddress(":8080"),
)
if err != nil {
log.Fatal(err)
}Arguments
| Argument | Type | Description |
|---|---|---|
applicationConfig | Config | Executable collections, globals, plugins, tasks, and application policy. |
options | []ExecuteOption | Runtime infrastructure and framework-owned server settings. |
Returns
The first joined project-command, startup, serving, drain, or cleanup failure.
errorHow it works
With project-command arguments, Execute resolves config and runs the versioned CLI protocol without applying runtime options or opening adapters. With no arguments, it starts the framework-owned HTTP server and requires WithStore.
Server startup opens the document store, opens optional upload storage, constructs the application, verifies readiness, binds the listener, and only then starts background workers. SIGINT or SIGTERM marks readiness as draining, shuts down HTTP work, drains workers, and closes lifecycle-owned adapters.
Execute blocks until the command or server lifecycle finishes. Return its error from main or log it as a fatal startup/runtime failure.
Full signature
func Execute(
applicationConfig Config,
options ...ExecuteOption,
) errorRelated types
ConfigThe complete author-owned application definition.
ExecuteOptionOne opaque runtime option accepted by Execute.