Sha256: 0fde2cc26345a92e6535d2dcc6ae3d8b86d09880905952f084aff9ed73699c30

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

module Jobshop
  class Engine < ::Rails::Engine
    isolate_namespace Jobshop

    config.eager_load_namespaces << Jobshop

    config.generators.api_only = true

    config.generators do |g|
      g.orm :active_record, primary_key_type: :uuid
      g.test_framework :rspec, view_specs: false
      g.helper false
      g.javascripts false
    end

    ActiveSupport::Inflector.inflections do |inflect|
      inflect.irregular "criterion", "criteria"
      inflect.acronym "JWT"
      inflect.acronym "RFQ"
      inflect.acronym "RFQs"
    end

    initializer "jobshop.active_record_enhancements" do
      ActiveSupport.on_load(:active_record) do
        require "activerecord_json_validator"
        require "composite_primary_keys"
      end
    end

    initializer "jobshop.middleware" do
      config.middleware.use Rack::Cors do
        allow do
          origins "localhost:4200"
          resource "*",
            headers: :any,
            expose: %w(access-token expiry token-type uid client),
            methods: %i(get post options delete put)
        end
      end
    end

    initializer "jobshop.append_paths", before: :load_config_initializers do |app|
      config.paths["db/migrate"].expanded.each do |expanded_path|
        app.config.paths["db/migrate"] << expanded_path
      end
    end

    initializer "jobshop.redis_session_store" do
      Rails.application.config.session_store(:redis_store, {
        servers: Jobshop.configuration.session_store_url
      })
    end

    initializer "jobshop.action_mailer.default_url_options" do
      config.action_mailer.default_url_options = {
        host: Jobshop.configuration.mailer_host
      }
    end

    initializer "jobshop.aws.config" do
      require "aws-sdk-core"

      Aws.config.update({
        credentials: Aws::Credentials.new(
          Jobshop.configuration.aws.access_key_id,
          Jobshop.configuration.aws.secret_access_key
        ),
        region: Jobshop.configuration.aws.region
      })
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobshop-0.0.163 lib/jobshop/engine.rb