Sha256: 90e8440fa20f884dbf9d2b01334b45cd43b21271b42f684ed64f74805105f04c
Contents?: true
Size: 1.93 KB
Versions: 15
Compression:
Stored size: 1.93 KB
Contents
# typed: false # frozen_string_literal: true require "propshaft" require "jbuilder" require "solid_queue" require "mission_control/jobs" module Hephaestus class Engine < ::Rails::Engine isolate_namespace Hephaestus config.generators.api_only = true GIT_SHA = case Rails.env when "production", "staging" ENV["GIT_SHA"] || "" when "development" %x(git rev-parse HEAD) when "test" "deadbeef" end.chomp require "hephaestus/http" initializer "hephaestus.add_middleware" do |app| Hephaestus::Engine.root.glob("lib/hephaestus/middleware/*.{rb}").each { |file| require_relative file } app.config.middleware.insert(0, Hephaestus::Middleware::TracingAttributes) app.config.middleware.insert(0, Hephaestus::Middleware::MalformedRequest) app.config.middleware.use(Hephaestus::Middleware::OpenapiValidation) end initializer :append_migrations do |app| unless app.root.to_s.match?(root.to_s) config.paths["db/migrate"].expanded.each do |expanded_path| app.config.paths["db/migrate"] << expanded_path ActiveRecord::Migrator.migrations_paths << expanded_path end end end class << self def insert_routes Rails.application.routes.draw do # Staff pages get("staff", to: "staff#index") constraints(->(request) { StaffController.staff_request?(request) }) do mount(MissionControl::Jobs::Engine, at: "staff/jobs", as: :staff_jobs) end ############################################# # error pages -- these MUST be at the end! ## ############################################# get("/500", to: "application#render500") if Rails.env.production? || Rails.env.staging? match("/", to: "application#not_found", via: :all) match("/*unmatched_route", to: "application#not_found", via: :all) end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems