module Roda::RodaPlugins::Public
def self.configure(app, opts={})
- :root
- Use this option for the root of the public directory (default: “public”)
:headers - A hash of headers to use for statically served files
for clients supporting brotli transfer encoding.
:brotli - Whether to serve already brotli-compressed files with a .br extension
supporting gzipped transfer encoding.
:gzip - Whether to serve already gzipped files with a .gz extension for clients
:default_mime -
The default mime type to use if the mime type is not recognized.
Use options given to setup a Rack::File instance for serving files. Options:
- Whether to serve already gzipped files with a .gz extension for clients
- Whether to serve already brotli-compressed files with a .br extension
- A hash of headers to use for statically served files
- Use this option for the root of the public directory (default: “public”)
def self.configure(app, opts={}) if opts[:root] app.opts[:public_root] = app.expand_path(opts[:root]) elsif !app.opts[:public_root] app.opts[:public_root] = app.expand_path("public") end app.opts[:public_server] = RACK_FILES.new(app.opts[:public_root], opts[:headers]||{}, opts[:default_mime] || 'text/plain') app.opts[:public_gzip] = opts[:gzip] app.opts[:public_brotli] = opts[:brotli] end