Sha256: d34c80dab54ab0a92c05d7147034cb82b395a62a1fd011dd4ec3a3f8cad083a6

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

# List all files that should be automatically loaded for apps using the Engine here (besides files in app/)
# There are multiple ways to accomplish this via autoloading or eagerloading,
# but using `require` seems to be the simplest, least-error-prone way.
require "nulogy_sso/controller_helper"

module NulogySSO
  class Engine < ::Rails::Engine
    isolate_namespace NulogySSO

    VERIFY_CONFIG = ENV["ASSETS_PRECOMPILE"].blank?

    # Load all gems in the gemspec, as opposed to explicit require calls
    Bundler.require(*Rails.groups)

    config.after_initialize do
      if VERIFY_CONFIG
        if NulogySSO.sso_config.blank?
          raise "Missing sso_config config object. Consider using config_for() to load a YAML config file."
        end

        if NulogySSO.find_user_by_email.blank?
          raise "Missing find_user_by_email config lambda."
        end

        if NulogySSO.handle_sso_error.blank?
          raise "Missing handle_sso_error config lambda."
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nulogy_sso-2.5.1 lib/nulogy_sso/engine.rb
nulogy_sso-2.5.0 lib/nulogy_sso/engine.rb
nulogy_sso-2.4.0 lib/nulogy_sso/engine.rb
nulogy_sso-2.3.1 lib/nulogy_sso/engine.rb
nulogy_sso-2.3.0 lib/nulogy_sso/engine.rb
nulogy_sso-2.2.0 lib/nulogy_sso/engine.rb