using rack :: auth :: basic in sinatra application, there is a way so that I can search for users and password from a simple yaml file (it doesnβt matter if the password is saved in clear form)
Yaml config / users.yml example
--- :users: usersA: :password: passwordA :otherdata: xxxxx userB: :password: passwordB
synatra configuration block that I am trying (without success). how can i search users from yaml file?
configure do config = YAML::load_file(File.join(Dir.pwd, 'config', 'users.yml')) use Rack::Auth::Basic, "login" do |u, p| [u, p] == [u, config[:users][username][:password]] end end
source share