Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Static Files

Venator has a dedicated static file share, which is exposed at /_matrix/static/. Any files and directories in the internal/venatord/api/static directory (including Go source files) will be available by nature of being embedded into the compiled binary.

Warning

Large assets should not reside here - everything in the static directory will be EMBEDDED into the compiled binary, verbatim (no compression is applied).

Content in the static directory does not permit cross-origin requests or authentication.

Generated content

Content can be generated by external tools and placed within the static share. To do so, //go:generate can be used to invoke shell commands during the build process. For example, building the docs with mdbook is as easy as adding //go:generate mdbook build -d docs/ ../../../../ to init.go. Note that the working directory for generate commands is the source file’s directory.

Generated content is always optional in Venator, so contributors should not expect that their generated content will be available in every build. Ideally, generation is gated behind build tags too.

Live reload

The static file share also supports not being very static. If Venator is compiled with the live build tag, the files in internal/venatord/api/static are read on-demand instead of being embedded at compile time. While a reasonable effort is put into ensuring live reload is immediately secure, you should not expose it to the internet, and ideally not outside testing environments either.