pub struct ForgeBuilder { /* private fields */ }Expand description
Builder for configuring the FORGE runtime.
Implementations§
Source§impl ForgeBuilder
impl ForgeBuilder
Sourcepub fn migrations_dir(self, path: impl Into<PathBuf>) -> Self
pub fn migrations_dir(self, path: impl Into<PathBuf>) -> Self
Set the directory to load migrations from.
Defaults to ./migrations. Migration files should be named like:
0001_create_users.sql0002_add_posts.sql
Sourcepub fn migration(self, name: impl Into<String>, sql: impl Into<String>) -> Self
pub fn migration(self, name: impl Into<String>, sql: impl Into<String>) -> Self
Add a migration programmatically.
Use this for migrations that need to be generated at runtime, or for testing. For most cases, use migration files instead.
Sourcepub fn frontend_handler(
&mut self,
handler: fn(Request<Body>) -> Pin<Box<dyn Future<Output = Response> + Send>>,
)
pub fn frontend_handler( &mut self, handler: fn(Request<Body>) -> Pin<Box<dyn Future<Output = Response> + Send>>, )
Set a frontend handler for serving embedded SPA assets.
Use with the embedded-frontend feature to build a single binary
that includes both backend and frontend.
Sourcepub fn custom_routes(&mut self, router: Router)
pub fn custom_routes(&mut self, router: Router)
Add custom axum routes to the server.
Routes are merged at the top level, outside /_api, giving full
control over headers, extractors, and response types. Avoid paths
starting with /_api as they conflict with internal routes.
use axum::{Router, routing::get};
let routes = Router::new()
.route("/custom/health", get(|| async { "ok" }));
builder.custom_routes(routes);Sourcepub fn config(self, config: ForgeConfig) -> Self
pub fn config(self, config: ForgeConfig) -> Self
Set the configuration.
Sourcepub fn function_registry_mut(&mut self) -> &mut FunctionRegistry
pub fn function_registry_mut(&mut self) -> &mut FunctionRegistry
Get mutable access to the function registry.
Sourcepub fn job_registry_mut(&mut self) -> &mut JobRegistry
pub fn job_registry_mut(&mut self) -> &mut JobRegistry
Get mutable access to the job registry.
Sourcepub fn mcp_registry_mut(&mut self) -> &mut McpToolRegistry
pub fn mcp_registry_mut(&mut self) -> &mut McpToolRegistry
Get mutable access to the MCP tool registry.
Sourcepub fn register_mcp_tool<T: ForgeMcpTool>(&mut self) -> &mut Self
pub fn register_mcp_tool<T: ForgeMcpTool>(&mut self) -> &mut Self
Register an MCP tool without manually accessing the registry.
Sourcepub fn cron_registry_mut(&mut self) -> &mut CronRegistry
pub fn cron_registry_mut(&mut self) -> &mut CronRegistry
Get mutable access to the cron registry.
Sourcepub fn workflow_registry_mut(&mut self) -> &mut WorkflowRegistry
pub fn workflow_registry_mut(&mut self) -> &mut WorkflowRegistry
Get mutable access to the workflow registry.
Sourcepub fn daemon_registry_mut(&mut self) -> &mut DaemonRegistry
pub fn daemon_registry_mut(&mut self) -> &mut DaemonRegistry
Get mutable access to the daemon registry.
Sourcepub fn webhook_registry_mut(&mut self) -> &mut WebhookRegistry
pub fn webhook_registry_mut(&mut self) -> &mut WebhookRegistry
Get mutable access to the webhook registry.
Sourcepub fn register_query<Q: ForgeQuery>(&mut self) -> &mut Self
pub fn register_query<Q: ForgeQuery>(&mut self) -> &mut Self
Register a query function.
Sourcepub fn register_mutation<M: ForgeMutation>(&mut self) -> &mut Self
pub fn register_mutation<M: ForgeMutation>(&mut self) -> &mut Self
Register a mutation function.
Sourcepub fn register_job<J: ForgeJob>(&mut self) -> &mut Self
pub fn register_job<J: ForgeJob>(&mut self) -> &mut Self
Register a background job.
Sourcepub fn register_cron<C: ForgeCron>(&mut self) -> &mut Self
pub fn register_cron<C: ForgeCron>(&mut self) -> &mut Self
Register a cron handler.
Sourcepub fn register_workflow<W: ForgeWorkflow>(&mut self) -> &mut Self
pub fn register_workflow<W: ForgeWorkflow>(&mut self) -> &mut Self
Register a workflow.
Sourcepub fn register_daemon<D: ForgeDaemon>(&mut self) -> &mut Self
pub fn register_daemon<D: ForgeDaemon>(&mut self) -> &mut Self
Register a daemon.
Sourcepub fn register_webhook<W: ForgeWebhook>(&mut self) -> &mut Self
pub fn register_webhook<W: ForgeWebhook>(&mut self) -> &mut Self
Register a webhook.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ForgeBuilder
impl !RefUnwindSafe for ForgeBuilder
impl Send for ForgeBuilder
impl Sync for ForgeBuilder
impl Unpin for ForgeBuilder
impl UnsafeUnpin for ForgeBuilder
impl !UnwindSafe for ForgeBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more