Module: Codeword::Configuration
- Defined in:
- lib/codeword/configuration.rb
Class Method Summary collapse
- .codeword_code ⇒ Object
- .codeword_cookie_lifetime ⇒ Object
- .cookie_lifetime ⇒ Object
- .from_credentials(setting) ⇒ Object
Class Method Details
.codeword_code ⇒ Object
17 18 19 |
# File 'lib/codeword/configuration.rb', line 17 def self.codeword_code @codeword_code ||= ENV['CODEWORD'] || from_credentials(:codeword) end |
.codeword_cookie_lifetime ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/codeword/configuration.rb', line 21 def self. weeks = .to_f if weeks.positive? weeks.weeks else 5.years end end |
.cookie_lifetime ⇒ Object
11 12 13 14 15 |
# File 'lib/codeword/configuration.rb', line 11 def self. @cookie_lifetime ||= ENV['COOKIE_LIFETIME_IN_WEEKS'] || from_credentials(:cookie_lifetime_in_weeks) end |
.from_credentials(setting) ⇒ Object
5 6 7 8 9 |
# File 'lib/codeword/configuration.rb', line 5 def self.from_credentials(setting) store = Rails.application.credentials store.dig(:codeword, setting) end |