2.6 KiB
2.6 KiB
Registry Configuration
Source:
src/content/docs/general/registry-configuration.mdxCanonical URL: https://rivet.dev/docs/general/registry-configuration Description: This page documents the configuration options available when setting up a RivetKit registry. The registry configuration is passed to thesetup()function.
Example Configurations
Basic Setup
import { setup, actor } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({
use: { myActor },
});
Connecting to Rivet Engine
import { setup, actor } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
// Reads from RIVET_ENDPOINT, RIVET_TOKEN, and RIVET_NAMESPACE
const registry = setup({
use: { myActor },
});
import { setup, actor } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({
use: { myActor },
endpoint: "https://api.rivet.dev",
token: process.env.RIVET_TOKEN,
namespace: "production",
});
Starting Your App
After configuring your registry, start it:
import { actor, setup } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });
registry.start();
import { actor, setup } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });
export default registry.serve();
import { Hono } from "hono";
import { actor, setup } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });
const app = new Hono();
app.all("/api/rivet/*", (c) => registry.handler(c.req.raw));
export default app;
import { actor, setup } from "rivetkit";
const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });
registry.startEnvoy();
See Runtime Modes for details on when to use each mode.
Environment Variables
Many configuration options can be set via environment variables. See Environment Variables for a complete reference.
Configuration Reference
Related
- Actor Configuration: Configure individual actors
- HTTP Server Setup: Set up HTTP routing and middleware
- Architecture: Understand how RivetKit works
Source doc path: /docs/general/registry-configuration