lib/wcc/contentful/app/configuration.rb in wcc-contentful-app-1.2.0 vs lib/wcc/contentful/app/configuration.rb in wcc-contentful-app-1.2.1
- old
+ new
@@ -17,11 +17,11 @@
delegate(*(WCC::Contentful::Configuration::ATTRIBUTES.map { |a| "#{a}=" }),
to: :wcc_contentful_config)
def initialize(wcc_contentful_config)
@wcc_contentful_config = wcc_contentful_config
- @preview_password = ENV['CONTENTFUL_PREVIEW_PASSWORD']
+ @preview_password = ENV.fetch('CONTENTFUL_PREVIEW_PASSWORD', nil)
end
# Validates the configuration, raising ArgumentError if anything is wrong. This
# is called by WCC::Contentful::App.init!
def validate!
@@ -31,19 +31,15 @@
def frozen?
false
end
class FrozenConfiguration
- attr_reader(*ATTRIBUTES)
+ attr_reader(*ATTRIBUTES, :wcc_contentful_config)
- attr_reader :wcc_contentful_config
-
delegate(*WCC::Contentful::Configuration::ATTRIBUTES, to: :wcc_contentful_config)
def initialize(configuration, frozen_wcc_contentful_config)
- unless frozen_wcc_contentful_config.frozen?
- raise ArgumentError, 'Please first freeze the wcc_contentful_config'
- end
+ raise ArgumentError, 'Please first freeze the wcc_contentful_config' unless frozen_wcc_contentful_config.frozen?
@wcc_contentful_config = frozen_wcc_contentful_config
ATTRIBUTES.each do |att|
val = configuration.public_send(att)