Sha256: 1d2c132a3b4430ed300d4aff0eb8121b2dc2d7371fed18eddca35ca234a35038

Contents?: true

Size: 899 Bytes

Versions: 10

Compression:

Stored size: 899 Bytes

Contents

require "hanami"
require "rack/attack"

<% namespace do %>
  # Defines global application configuration.
  class App < Hanami::App
    Dry::Schema.load_extensions :monads
    Dry::Validation.load_extensions :monads

    config.actions.content_security_policy[:script_src] = "'self' 'unsafe-eval'"

    Rack::Attack.safelist("allow localhost") { |request| %w[127.0.0.1 ::1].include? request.ip }
    Rack::Attack.throttle("requests by IP", limit: 100, period: 60, &:ip)

    config.middleware.use Rack::Attack
    config.middleware.use Rack::Deflater
    config.middleware.use Rack::Static, {urls: %w[/stylesheets /javascripts], root: "public"}

    environment :development do
      config.logger.options[:colorize] = true

      config.logger = config.logger.instance.add_backend(
        colorize: false,
        stream: Hanami.app.root.join("log/development.log")
      )
    end
  end
<% end %>

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hanamismith-0.15.0 lib/hanamismith/templates/%project_name%/config/app.rb.erb
hanamismith-0.14.1 lib/hanamismith/templates/%project_name%/config/app.rb.erb
hanamismith-0.14.0 lib/hanamismith/templates/%project_name%/config/app.rb.erb
hanamismith-0.13.0 lib/hanamismith/templates/%project_name%/config/app.rb.erb
hanamismith-0.12.0 lib/hanamismith/templates/%project_name%/config/app.rb.erb
hanamismith-0.11.0 lib/hanamismith/templates/%project_name%/config/app.rb.erb
hanamismith-0.10.0 lib/hanamismith/templates/%project_name%/config/app.rb.erb
hanamismith-0.9.0 lib/hanamismith/templates/%project_name%/config/app.rb.erb
hanamismith-0.8.0 lib/hanamismith/templates/%project_name%/config/app.rb.erb
hanamismith-0.7.0 lib/hanamismith/templates/%project_name%/config/app.rb.erb