-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Feature Request: Operating system interface for file server #3720
Comments
Did a bit of googling, https://github.com/spf13/afero/ looks like a pretty solid option for a filesystem abstraction layer. The S3 support doesn't look super certain though, from what I'm reading, but this is the most recent iteration: https://github.com/fclairamb/afero-s3, discussion here: spf13/afero#90 (comment) If you'd like to give a shot at implementing this (maybe separate from the existing I can already think of a few neat features we could get from using afero, e.g. optional cache-to-memory-on-read, so repeat requests to the same file would hit memory instead of disk (this is super easy, it's basically 3 lines to set up with afero, see the readme). Also, note that there's also the |
I think we should wait and see if the Go team continues to develop a mature FS abstraction: https://go.googlesource.com/proposal/+/master/design/draft-iofs.md |
This has landed in Go 1.16! https://golang.org/doc/go1.16#fs We'll need to wait until we bump Caddy's minimum Go version to 1.16. We just bumped to minimum of 1.15, so if we go by that pattern of supporting the past two versions of Go, then that might be 6 months from now after 1.17 is released. TBD. |
Now that we've bumped to minimum of Go 1.16, this is now a refactor we could do! This isn't a top priority, so if some enterprising individual wants to give us a hand, this would be a good issue to pick up! |
This change replaces the hard-coded use of os.Open() and os.Stat() with the use of the new (Go 1.16) io/fs APIs, enabling virtual file systems. It introduces a new module namespace, caddy.fs, for such file systems. Also improve documentation for the file server. I realized it was one of the first modules written for Caddy 2, and the docs hadn't really been updated since!
@mholt I'm excited about the implementation of this feature!!! |
FYI - https://github.com/hairyhenderson/go-fsimpl provides some useful (IMO) filesystems for |
@hairyhenderson That's very cool! |
* fileserver: Support virtual file systems (close #3720) This change replaces the hard-coded use of os.Open() and os.Stat() with the use of the new (Go 1.16) io/fs APIs, enabling virtual file systems. It introduces a new module namespace, caddy.fs, for such file systems. Also improve documentation for the file server. I realized it was one of the first modules written for Caddy 2, and the docs hadn't really been updated since! * Virtualize FS for file matcher; minor tweaks * Fix tests and rename dirFS -> osFS (Since we do not use a root directory, it is dynamic.)
Currently, File server module only support file system.
I think the File server module could support more data sources, such as S3 or elsewhere.
This could be done by implementing a Certmagic storage interface, or roughly an OS compatible interface.
The text was updated successfully, but these errors were encountered: