function

Execute

Run the API, admin, jobs, and shutdown lifecycle.

Example

go
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

ArgumentTypeDescription
applicationConfigConfigExecutable collections, globals, plugins, tasks, and application policy.
options[]ExecuteOptionRuntime infrastructure and framework-owned server settings.

Returns

The first joined project-command, startup, serving, drain, or cleanup failure.

error

How 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, ) error

Source ridu.go:355

Related types

  • Config

    The complete author-owned application definition.

  • ExecuteOption

    One opaque runtime option accepted by Execute.