lib/hanami/configuration/actions.rb in hanami-2.0.0.alpha8 vs lib/hanami/configuration/actions.rb in hanami-2.0.0.beta1
- old
+ new
@@ -3,11 +3,11 @@
require "dry/configurable"
require "hanami/action/configuration"
require_relative "actions/cookies"
require_relative "actions/sessions"
require_relative "actions/content_security_policy"
-require_relative "../application/view_name_inferrer"
+require_relative "../slice/view_name_inferrer"
module Hanami
class Configuration
# Hanami actions configuration
#
@@ -18,18 +18,18 @@
setting :cookies, default: {}, constructor: -> options { Cookies.new(options) }
setting :sessions, constructor: proc { |storage, *options| Sessions.new(storage, *options) }
setting :csrf_protection
setting :name_inference_base, default: "actions"
- setting :view_context_identifier, default: "view.context"
- setting :view_name_inferrer, default: Application::ViewNameInferrer
+ setting :view_context_identifier, default: "views.context"
+ setting :view_name_inferrer, default: Slice::ViewNameInferrer
setting :view_name_inference_base, default: "views"
attr_accessor :content_security_policy
attr_reader :base_configuration
- private :base_configuration
+ protected :base_configuration
def initialize(*, **options)
super()
@base_configuration = Hanami::Action::Configuration.new
@@ -39,9 +39,15 @@
csp[:style_src] += " #{assets_server_url}"
end
end
configure_defaults
+ end
+
+ def initialize_copy(source)
+ super
+ @base_configuration = source.base_configuration.dup
+ @content_security_policy = source.content_security_policy.dup
end
def finalize!
# A nil value for `csrf_protection` means it has not been explicitly configured
# (neither true nor false), so we can default it to whether sessions are enabled