Skip to content

Keycard Integration

Greg Kostin edited this page Jun 8, 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

./bin/setup
  files = ['keycard-development', 'keycard-test']

./bin/travis
  files = ['keycard-development', 'keycard-test']

./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.sample
./db/keycard-test.sqlite3.sample

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