Class: Hanami::Config
- Includes:
- Dry::Configurable
- Defined in:
- gems/gems/hanami-2.1.0/lib/hanami/config.rb,
gems/gems/hanami-2.1.0/lib/hanami/config/views.rb,
gems/gems/hanami-2.1.0/lib/hanami/config/assets.rb,
gems/gems/hanami-2.1.0/lib/hanami/config/logger.rb,
gems/gems/hanami-2.1.0/lib/hanami/config/router.rb,
gems/gems/hanami-2.1.0/lib/hanami/config/actions.rb,
gems/gems/hanami-2.1.0/lib/hanami/config/null_config.rb,
gems/gems/hanami-2.1.0/lib/hanami/config/actions/cookies.rb,
gems/gems/hanami-2.1.0/lib/hanami/config/actions/sessions.rb,
gems/gems/hanami-2.1.0/lib/hanami/config/actions/content_security_policy.rb
Overview
Hanami app config
Defined Under Namespace
Classes: NullConfig
Constant Summary collapse
- SUPPORTED_MIDDLEWARE_PARSERS =
%i[json].freeze
Instance Method Summary collapse
- #load_dependent_config(gem_name) ⇒ Object private
- #load_from_env ⇒ Object private
- #method_missing(name, *args, &block) ⇒ Object private
- #respond_to_missing?(name, _incude_all = false) ⇒ Boolean private
- #use_body_parser_middleware ⇒ Object private
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Method Details
#load_dependent_config(gem_name) ⇒ Object (private)
Source: | on GitHub
def load_dependent_config(gem_name) if Hanami.bundled?(gem_name) yield else require_relative "config/null_config" NullConfig.new end end |
#load_from_env ⇒ Object (private)
Source: | on GitHub
def load_from_env self.slices = ENV["HANAMI_SLICES"]&.split(",")&.map(&:strip) end |
#respond_to_missing?(name, _incude_all = false) ⇒ Boolean (private)
Source: | on GitHub
def respond_to_missing?(name, _incude_all = false) config.respond_to?(name) || super end |
#use_body_parser_middleware ⇒ Object (private)
Source: | on GitHub
def use_body_parser_middleware return unless Hanami.bundled?("hanami-controller") return if actions.formats.empty? return if middleware.stack["/"].map(&:first).any? { |klass| klass == "Hanami::Middleware::BodyParser" } parsers = SUPPORTED_MIDDLEWARE_PARSERS & actions.formats.values return if parsers.empty? middleware.use( :body_parser, [parsers.to_h { |parser_format| [parser_format, actions.formats.mime_types_for(parser_format)] }] ) end |