-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
feat: allow fs embedding with --embed
#160
Conversation
Oh neat!! This is cool, I'll give it a look soon :) |
I'm not sure how embedding works, but can we have like a |
Now that I stepped back and thought about it, the current implementation can support it if the user provides the dirs already nested. In other words, if they embed
They can do
If the user specifies multiple One thing I'd like to address is to somehow expose the embedded FS tree so users can inspect their fat binaries. That can be in a follow-up. |
Can we allow the user to pass multiple |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this could be a neat/useful enhancement!
Done. You can now specify multiple |
Nice! 👏 So I assume this works?
With config:
Correct me if I'm wrong 🤔 We'll also need to cover this in the README.md Also I think we're missing support for |
Yep, yep, and yep.
Hm... perhaps, I haven't inspected the extenet of that particular change in Caddy. We can create an issue to track it. Edit: |
This is neat!! Is it ready to go? |
Yep! |
Thanks for working on this :) Let's give it a try |
https://caddyserver.com/docs/caddyfile/directives/try_files doesn't though I think (easy fix though). And I think we should use a var or whatever to bubble it down to other modules similarly to |
I really like this feature. But sadly for example directories like See golang/go#43854 |
Furthermore I wonder if I could use embedded files with cli command only instead of using Some sort of |
It may be possible to include a condition/flag to have the
We cannot add a flag to a command that's defined elsewhere (i.e. the file-server module in this case). I personally believe one must bite the bullet at some point and switch to config files, i.e. Caddyfile, rather than craft long lines of commands and flags. If we are to add a flag, it'd be |
This PR adds the ability to embed a folder into the compiled Caddy by copying the entire tree passed via
--embed
(orBuilder#EmbedDir
struct field) that's specified into a directory namedfiles
under the temporary build directory and synthesize a Caddy module in the same dir (a copy of github.com/mholt/caddy-embed). This function relies on Go'sembed
package for embedding capability, thus it abides by the rules listed in its documentation.I couldn't figure out to how to do multiple folders to allow the file server to do serve different roots, henceit's marked Experimental 🤷🏼Resolves #130
Resolves mholt/caddy-embed#1