Hooks

Deploy the Grafbase Gateway together with the WASM file that contains the code for your custom hooks.

[hooks] location = "path/to/custom.component.wasm" networking = false stdout = false stderr = false environment_variables = false max_pool_size = 1000
  • location specifies the path to the WASM file that contains custom hooks. You must provide a valid path and have read access to the file.
  • networking enables network access with TCP and UDP sockets, name resolution and WASI HTTP bindings to the guest. TCP and UDP sockets work only if the guest language supports WASI preview 2 standard. Default value is false.
  • stdout enables the guest to write to the standard output stream. Default value is false.
  • stderr enables the guest to write to the standard error stream. Default value is false.
  • environment_variables copies host environment variables to the guest. Default value is false.
  • max_pool_size specifies the number of hook instances that can run concurrently. Default value is four times the number of CPU cores.

Define one or more pre-opened directories to enable file system access for guests:

[[hooks.preopened_directories]] host_path = "/path/in/host/filesystem" guest_path = "/path/in/guest/filesystem" read_permission = true write_permission = true
  • host_path specifies an existing directory in the host filesystem. Give the user executing the Grafbase Gateway binary access to this directory.
  • guest_path defines the path visible in the guest. Set this virtual path to any value. The guest uses this path to access the filesystem.
  • read_permission allows reading all files and directories from the specified host_path.
  • write_permission allows creating and modifying files and directories in the specified host_path.