mirror of
https://github.com/usetrmnl/terminus.git
synced 2026-08-13 14:29:27 -07:00
link:https://github.com/simplecov-ruby/simplecov/blob/main/CHANGELOG.md#100-2026-07-12[Details]. This includes the following: * My long standing bug has been fixed which allows for implicit elses to be ignored. This cleans up code related to using monads with pattern matching which is nice to see. * We still can't enable ERB code coverage (this is why the templates are skipped). I've logged a few more new bugs on the SimpleCov side to tackle. This might take a while because I noticed Erik Berlin logged issues with Ruby core in order to make this possible. * Use of the *strict* profile ensures all code committed to this project must be 100%. This also cleans up having to be explicit about this. Milestone: patch
39 lines
1.2 KiB
Ruby
39 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require "hanami"
|
|
require "petail"
|
|
|
|
require_relative "initializers/rack_attack"
|
|
require_relative "initializers/universal_logger_patch"
|
|
|
|
module Terminus
|
|
# The application base configuration.
|
|
class App < Hanami::App
|
|
RubyVM::YJIT.enable if defined? RubyVM::YJIT
|
|
Dry::Schema.load_extensions :monads
|
|
Dry::Validation.load_extensions :monads
|
|
|
|
config.inflections { it.acronym "DEFAULTS", "HTML", "IP", "MAC", "URI" }
|
|
|
|
config.actions.content_security_policy.then do |csp|
|
|
csp[:connect_src] += " https://trmnl.com"
|
|
csp[:font_src] += " https://trmnl.com"
|
|
csp[:manifest_src] = "'self'"
|
|
csp[:script_src] += " 'unsafe-eval' 'unsafe-inline' https://trmnl.com"
|
|
end
|
|
|
|
config.actions.formats.register :problem_details, Petail::MEDIA_TYPE_JSON
|
|
|
|
# rubocop:todo Layout/FirstArrayElementLineBreak
|
|
config.actions.sessions = :cookie,
|
|
{
|
|
key: "terminus.session",
|
|
secret: settings.app_secret,
|
|
expire_after: 3_600 # 1 hour.
|
|
}
|
|
# rubocop:enable Layout/FirstArrayElementLineBreak
|
|
|
|
config.middleware.use Rack::Attack
|
|
end
|
|
end
|