-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider moving to xcaddy
project
#1
Comments
This is probably doable. We might want to generalize that implementation to support any other Caddy modules that use go:embed. But yeah, I like the idea. First, letsee how it goes separately on its own for a while, see how popular it is, etc. |
I have an idea for this. There will be 2 parts to support this:
|
Yeah, that was my thinking @mohammed90. Does it need to be zipped though? Doesn't that just add friction? I thought we could embed a whole directory. Unless you mean we should zip to compress in the compiled binary (reduce binary's size)? We'd need to make sure the |
The compression isn't to reduce the binary size. It's for the benefit of having the magic header to know where it starts and to conserve the file structure. The opening of the zip can be in the I wonder if github.com/mholt/archiver/v4 may be useful to make the ambivalent to the embedded archive type. |
Currently, this approach has some UX problems. It requires cloning this repo and copying the files to embed to inside of the repo. This is awkward for various reasons, such as fighting with
git
with thefiles
directory, having to clone at all meaning you have some extra directory sitting around, having to copy your files yourself (i.e. needing to write a script/Makefile to automate it), needing to modifymodule.go
if you want to rename the embed, etc.My suggestion is that we could move this to the https://github.com/caddyserver/xcaddy project, where it would be a build flag, i.e.
xcaddy build --embed <path>
. Thenxcaddy
would create themodule.go
file itself into a temp dir, optionally change the//go:embed
line to use a different base path (maybe with another flag like--embed-dir
), copy the given path (files to embed) to inside of the temp dir, then invoke the build as normal.I think this would be significantly better UX, because there would be no need for messing around with
git
, no copying files by hand, no need to write your own build script to make it work as a repeated command. It would just become an argument to thexcaddy build
command they (probably) already use.The text was updated successfully, but these errors were encountered: