function

Execute

func Execute( applicationConfig Config, options ...ExecuteOption, ) error

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

Source ridu.go:276

@param applicationConfig
Executable collections, globals, plugins, tasks, and application policy.
@param options
Runtime infrastructure and framework-owned server settings.
@returns
The first joined project-command, startup, serving, drain, or cleanup failure.

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.

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)
}

Related types

  • Config

    The complete author-owned application definition.

  • ExecuteOption

    One opaque runtime option accepted by Execute.