TypeScript (with Bun) support is available in wgc@0.96.0 and above.
bin/grpc-health-check folder, patches folder, and src/plugin-server.ts.
plugin-server.ts
Provides similar minimal functionality to the router-plugin package for Go, which internally uses the official Hashicorp go-plugin plugin server helper functions.
This provides the following out of the box
- Health Check using the grpc-health-check package
- Create a unix socket for communication and initialize the stdout plugin handshake
patches
- When bun compiles binaries it sets values for
__dirnameat compile-time, this ends up breaking thegrpc-health-checkpackage as it attempts to load ahealth.protodefinition from an incorrect path. As a workaround we have used thebun patchfunctionality to set the path to where the bun binary resides at runtime. - While the inquire index.js file here has been updated to not use eval, however it has not been published to npm, most likely due to a build step issue. We use the
bun patchfunctionality to use the correct version.
grpc-health-check
- When you build a plugin using
wgc router plugin build <pluginName>, the binary is placed in thebinfolder. In addition, thehealth.protodefinition is copied into the correct directory structure undergrpc-health-check. Ensure that both the binary and thegrpc-health-checkfolder are copied over when deploying or running the plugin.