Skip to content

Keycard Integration

Greg Kostin edited this page Mar 15, 2018 · 2 revisions
./Gemfile
# Keycard provides authentication support and user/request information
gem 'keycard', github: 'mlibrary/keycard'

./app/controllers/application_controller.rb
session[:identity] = identity || Keycard::RequestAttributes.new(request).all

./config/initializers/services.rb
if Settings.keycard&.database
  Keycard::DB.config.opts = Settings.keycard.database
end

./config/settings/development.yml
keycard:
  database:
    adapter: sqlite
    database: db/keycard-development.sqlite3
    pool: 5
    timeout: 5000

./config/settings/test.yml
keycard:
  database:
    adapter: sqlite
    database: db/keycard-test.sqlite3
    pool: 5
    timeout: 5000

./db/keycard-test.sqlite3

NOTE: ./db/keycard-test.sqlite3 was added to the git repository to support Travis CI integration a.k.a. the database needs to exists for Travis to run.