mirror of
https://github.com/gravitational/teleport
synced 2024-10-20 17:23:22 +00:00
d29a88f524
Functionality: `teleport` binary now serves web assets from its own binary file. Unless `DEBUG` environment variable is set to "1" or "true", in this case it will look for ../web/dist (as located in github repo) which can be used for development. Design: To avoid accumulating 3rd party dependencies with a ton of extra features and licenses, this implementation uses minimalistic implementation of http.FileSystem interface on top of the embedded ZIP archive. 1. The assets are zipped into assets.zip during build process 2. assets.zip gets appended to the end of `teleport` binary 3. The resulting file is converted into a self-extracting ZIP 4. Teleport opens itself using the built-in zip unarchiver, and loads the assets on demand. Notes: 1. LOC is tiny (dozens) 2. RAM consumption is CONSTANT regardless of the ZIP size, about 500Kb increase vs load-from-file, and most of it is linking zip archive code from the standard library. Tested with a 20MB ZIP archive.
100 KiB
100 KiB