Using RackDAV to open the webdav directory in a Rails application, how can I map a directory for maintenance?

I use RackDAV and it is GREAT! http://github.com/georgi/rack_dav

However, the only way to integrate it into my Rails application is to modify the server startup file that I copied from / vendor / rails / railties / rails / commands / server file! Obviously, this is not great. This works for me:

app = Rack::Builder.new { use Rails::Rack::LogTailer unless options[:detach] use Rails::Rack::Debugger if options[:debugger] map map_path do use Rails::Rack::Static run inner_app end map "/webdav/" do use Rack::ShowExceptions use Rack::CommonLogger use Rack::Reloader use Rack::Lint run RackDAV::Handler.new(:root => SOLR_CORES_FILESYSTEM) end }.to_app 

I want to be able to specify a handler elsewhere, for example, in environment.rb, but I cannot figure out how to work with the display aspect. Has anyone connected RackDAV to Rails?

+4
source share
2 answers

Add the gem 'rack_dav' to your Gemfile application and paste it into your routes.rb :

 mount RackDAV::Handler.new(:root => SOLR_CORES_FILESYSTEM), at: "/webdav" 
0
source

You can invoke RackDAV from a metal endpoint in Rails. I can show you an example if you need it, but it is quite simple.

-2
source

Source: https://habr.com/ru/post/1302192/


All Articles