Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.5 KB

README.md

File metadata and controls

34 lines (23 loc) · 1.5 KB

Generating Cloudflare workerd configs with capnproto-rust

This is a brief example to demonstrate how you can generate configuration files for Cloudflare workerd using the serialisation feature of capnproto-rust.

Requirements

Updating the schema

I've already included the resulting Rust code in this repository at src/workerd.rs - but it can be updated with:

capnp compile -orust:src/ --src-prefix=schema/ ./schema/workerd.capnp

This will generate a file called workerd_capnp.rs in the src folder - you can rename this if preferred.

Usage

It will output a binary config to stdout, which you can redirect to a file and then use with workerd like so:

cargo run > config.bin
workerd serve -b config.bin
  • The -b flag indicates it is a binary config rather than text.