Skip to Content
BricoleDocs

Operator configuration

Look up each field in bricole.jsonc, when it is required, and how it changes a host.

An operator file describes one installation. The operator CLI reads it from the path passed to --config and generates Wrangler configurations for the Workers. Keep the file with the installation’s deployment records. The version in your Bricole checkout determines the schema and the runtime settings inherited from the release.

For a new email installation, copy packages/operator/bricole.example.jsonc. For OIDC, copy packages/operator/bricole.oidc.example.jsonc. This third example uses Cloudflare Access without an identity Worker or mail sender. All identifiers and domains here are fictional.

{
  "config": 1,
  "account": "0123456789abcdef0123456789abcdef",
  "worker": "field-station",
  "domains": { "apps": "example.org", "host": "station.example.org" },
  "identity": {
    "provider": "access",
    "access": {
      "teamDomain": "https://field-station.cloudflareaccess.com",
      "audience": "example-application-audience",
    },
  },
}

Run bun run operator check --config <file> from the checkout. An editor can validate the field names and types. The command also enforces relationships between fields. Unknown fields are rejected. See the installation guide for the steps outside the file.

Installation and routing

FieldRequirement and effect
$schemaOptional string pointing your editor at packages/operator/schema/config-1.json. Resolve the path relative to your own file. The CLI uses its bundled validator.
configRequired integer version, currently 1. An unreadable version stops the command.
accountRequired Cloudflare account ID, 32 hexadecimal characters. Uppercase is accepted and normalized to lowercase. Pins the account for generated configurations and Wrangler calls.
workerRequired host Worker name. Use 1–54 lowercase letters, digits and interior hyphens. Its Durable Objects and secrets belong to this Worker. Keep the name stable across upgrades.
domainsRequired object describing the host and the domain used for artifact origins. Hostnames throughout the file use lowercase DNS labels and have a maximum length of 253 characters.
domains.appsRequired domain for artifact, public website and shared-view origins. The operator generates a wildcard zone route here. Leave room within 253 characters for the generated hostname, including prefix, 26-character ID, optional suffix and dot.
domains.hostRequired first-level subdomain of domains.apps, for example station.example.org. Its label must be distinct from the reserved art-, site- and view- prefixes. People sign in at this hostname.
domains.hostRouteDefaults to custom-domain, which generates an exact Worker Custom Domain. Use zone-route for a host reached through a zone route such as station.example.org/*.
domains.labelSuffixDefaults to the empty string. Otherwise use a hyphen followed by 1–31 lowercase letters or digits. For -lab, the wildcard route becomes *-lab.example.org/*. This changes the derived artifact origins.
websitesOptional mapping, empty by default, from an exact hostname to the artifact whose released website should answer there. Values use art_ followed by 26 lowercase base32 characters (a–z, 2–7). For example, "www.example.org": "art_aaaaaaaaaaaaaaaaaaaaaaaaaa". Each key generates a Custom Domain. The host’s own name and reserved first-level artifact labels on the apps domain are refused. Publish a website revision on the artifact separately.
resourcesOptional on first install. On upgrade, supply the resources belonging to this installation. The analytics block also requires this object.
resources.oauthKvRequired inside resources. ID of the host’s OAuth KV namespace, 32 lowercase hexadecimal characters. A fresh install can create a namespace named after the Worker with -oauth appended. Save the returned ID for upgrades.

Identity

Choose one provider. Email codes require both the identity service and a sender. OIDC requires the service and an OIDC client. Access requires the Access application settings and can operate without the identity service. OIDC and Access can also send invitation mail when you configure both the service and a sender. See authentication for the sign-in workflows.

FieldRequirement and effect
identityRequired object defining how people sign in.
identity.providerRequired. One of email, access or oidc. Sets the host’s SIGN_IN_PROVIDER.
identity.serviceRequired for email, OIDC or any configured sender. Declares a private identity Worker bound to the host as IDENTITY. Optional for Access without mail.
identity.service.workerRequired within the service. A distinct Worker name, 1–63 lowercase letters, digits and interior hyphens. Also names the identity D1 database created on first install.
identity.service.databaseOptional on first install, required on upgrade with the service. Lowercase hexadecimal D1 database UUID in 8-4-4-4-12 format. Record the ID returned on creation.
identity.service.secretRequired within the service. A reference object for the secret used by the identity Worker.
identity.service.secret.secretRequired literal AUTH_SECRET. The installer generates its value on first deployment of the identity Worker.
identity.emailRequired for email-code sign-in. Optional on Access or OIDC with a service for invitation mail. Enables an Email Sending binding on the identity Worker.
identity.email.fromRequired inside email. A valid sender email address on a domain with Email Sending enabled, for example station@notify.example.org. Sets EMAIL_FROM.
identity.accessRequired and accepted only for the Access provider. Configure the Access application on the host’s /auth/access route.
identity.access.teamDomainRequired Access team origin of the form https://team-name.cloudflareaccess.com, with no trailing slash. Uploaded to the host as ACCESS_TEAM_DOMAIN.
identity.access.audienceRequired nonempty Access application AUD tag. Uploaded to the host as ACCESS_AUD and checked against the assertion.
identity.access.emailVerifiedBoolean, defaults to false. Set to true only when the configured Access identity methods verify email addresses. This lets Bricole trust an asserted email for operations such as matching the creator list.
identity.oidcRequired and accepted only for OIDC. The client requests openid email.
identity.oidc.issuerRequired HTTPS issuer exactly as in discovery, including any path. Credentials, whitespace, backslashes, query and fragment are rejected. A changed issuer changes the identity namespace.
identity.oidc.clientIdRequired nonempty ID of the client registered with that issuer. Register https://station.example.org/auth/oidc/callback/oidc, substituting your host.
identity.oidc.clientSecretRequired reference object naming the identity Worker’s OIDC client secret.
identity.oidc.clientSecret.secretRequired literal OIDC_CLIENT_SECRET. Supply the provider-issued value from the deploy environment when the Worker first needs it.

Usage analytics

Enable analytics after the first deployment, when both Durable Object namespace IDs are available. Add the block below alongside the existing resources.oauthKv pin. Find the namespaces by host Worker and class in the Cloudflare dashboard. The IDs in the example are fictional.

"analytics": {
  "token": { "secret": "CLOUDFLARE_ANALYTICS_TOKEN" },
  "namespaces": {
    "artifacts": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "directory": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
  }
}
FieldRequirement and effect
analyticsOptional object enabling live Cloudflare analytics on the admin Usage page. Requires resources.oauthKv. Omitting the block leaves usage unconfigured.
analytics.tokenRequired within analytics. Reference to a host secret with Account Analytics: Read on this installation’s account.
analytics.token.secretRequired literal CLOUDFLARE_ANALYTICS_TOKEN. Provide the value in the deploy environment the first time it is needed.
analytics.namespacesRequired within analytics. Identifies two distinct Durable Object namespaces, each a 32-character lowercase hexadecimal ID.
analytics.namespaces.artifactsRequired ID of the host Worker’s Artifact class. Used for artifact usage and storage.
analytics.namespaces.directoryRequired ID of its Directory class. Used for directory usage and storage.

Removing the analytics block and deploying disables usage reporting. The host secret persists until you delete it, and the Cloudflare credential persists until you revoke it.

Existing Durable Object migrations

New installations inherit the release’s Durable Object exports. An existing Worker still using Wrangler migration tags can carry its original history in the operator file. Copy the deployed history in its original order. Each class or script name below is a nonempty string.

FieldRequirement and effect
legacyMigrationsOptional nonempty array, upgrade only. Replaces the release’s exports with the historical Wrangler migrations. Each tag must be unique and the active migration tag must be the final entry.
legacyMigrations[].tagRequired nonempty name of the historical migration.
legacyMigrations[].new_classesOptional array of class names introduced with classic Durable Object storage.
legacyMigrations[].new_sqlite_classesOptional array of class names introduced with SQLite storage.
legacyMigrations[].renamed_classesOptional array recording class renames in this Worker.
legacyMigrations[].renamed_classes[].fromRequired previous class name in each rename.
legacyMigrations[].renamed_classes[].toRequired replacement class name in each rename.
legacyMigrations[].transferred_classesOptional array recording classes transferred from another Worker.
legacyMigrations[].transferred_classes[].fromRequired source class name in each transfer.
legacyMigrations[].transferred_classes[].from_scriptRequired source Worker name in each transfer.
legacyMigrations[].transferred_classes[].toRequired class name in the receiving Worker.
legacyMigrations[].deleted_classesOptional array of class names deleted in the historical migration.

The deploy command refuses pending history, deletions in generated exports and changes to the deployed class set. Review the operator CLI before modifying a live installation.