-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically configure API token cache
Previously we required each API app to use efficient caching practices. This DRYs up the manual, repetitive caching config, so that we always cache bearer token responses unless configured otherwise.
- Loading branch information
Ben Thorner
committed
Oct 26, 2020
1 parent
915a285
commit 2d5df7c
Showing
4 changed files
with
25 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module GDS | ||
module SSO | ||
class Railtie < Rails::Railtie | ||
initializer "gds-sso.initializer" do |app| | ||
GDS::SSO.config do |config| | ||
config.cache = Rails.cache | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
require "rails" | ||
require "spec_helper" | ||
|
||
RSpec.describe GDS::SSO::Railtie do | ||
let(:cache) { double(:cache) } | ||
|
||
it "re-uses the Rails cache" do | ||
expect(GDS::SSO::Config.cache).to eq Rails.cache | ||
end | ||
end |