clabland / go-homelab-cable

KHLC: A cable station for your homelab.
MIT License
114 stars 20 forks source link

Updated server.go to embed the relevant web files #5

Closed sgosiaco closed 10 months ago

sgosiaco commented 10 months ago

I recently saw your video on youtube and it's a cool project. But I noticed that with how the code is currently setup, it requires the html/css files to be in the proper relative directories compared to the binary to operate.

This PR solves that issue by using //go:embed in order to embed the relevant files directly into the binary during compilation. So after this change, once you compile the binary you can move it to anywhere on your system and it will run without requiring the html/css files to also be copied.

For reference here is the difference in compiled binary size with and without embedding Without: 12,810,184 bytes With: 12,830,008 bytes Difference: 19,824 bytes

clabland commented 10 months ago

Nice improvement! Just tested a bit and it works great. Thank you!