lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.94k stars 397 forks source link

Basic Authentication? #1072

Closed phortx closed 7 years ago

phortx commented 7 years ago

I'm hosting our YARD Documentation Portal at heroku. Due the fact, that this is a closed source project, we need to keep the documentation password protected. Basic Authentication would be the easiest solution.

Unfortunately yard doesn't support BA (despite there's a Pull Request) and it seems like there are no plugins or examples how to setup a basic authentication.

Do you have any advice how to achieve a password protected yard installation on heroku?

Thank you very much for your time!

phortx commented 7 years ago

Found a solution on myself: Via Rack.

config.ru:

require 'bundler/setup'

Bundler.require(:default, ENV['RACK_ENV'])

use Rack::Auth::Basic, "Please Sign In" do |username, password|
  [username, password] == ['foo', 'bar']
end

libraries = {
   # ...
}

run YARD::Server::RackAdapter.new(libraries)

Run bundle exec rackup config.ru to spawn the server