Sha256: fbdb76470a2fe9a73ba399a453a46d9974b3219d59f026b5f2bb24112ea8040b

Contents?: true

Size: 1.33 KB

Versions: 12

Compression:

Stored size: 1.33 KB

Contents

require 'active_support/all'
require 'dotenv'
require 'dry/system'
require 'sequel'
require_relative 'boot'

module Inferno
  class Application < Dry::System::Container
    ::Inferno::Import = injector

    use :env, inferrer: -> { ENV.fetch('APP_ENV', :development).to_sym }

    raw_js_host = ENV.fetch('JS_HOST', '')
    base_path = ENV.fetch('BASE_PATH', '')
    public_path = base_path.blank? ? '/public' : "/#{base_path}/public"
    jwks_path = base_path.blank? ? '/jwks.json' : "/#{base_path}/jwks.json"
    js_host = raw_js_host.present? ? "#{raw_js_host}/public" : public_path

    Application.register('js_host', js_host)
    Application.register('base_path', base_path)
    Application.register('public_path', public_path)
    Application.register('async_jobs', ENV['ASYNC_JOBS'] != 'false')
    Application.register('inferno_host', ENV.fetch('INFERNO_HOST', 'http://localhost:4567'))
    Application.register('base_url', URI.join(Application['inferno_host'], base_path).to_s)
    Application.register('jwks_url', URI.join(Application['inferno_host'], jwks_path).to_s)
    Application.register('cache_bust_token', SecureRandom.uuid)

    configure do |config|
      config.root = File.expand_path('../../..', __dir__)
      config.provider_dirs = [File.join('lib', 'inferno', 'config', 'boot')]
      config.component_dirs.add 'lib'
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
inferno_core-0.6.1 lib/inferno/config/application.rb
inferno_core-0.6.0 lib/inferno/config/application.rb
inferno_core-0.5.4 lib/inferno/config/application.rb
inferno_core-0.5.3 lib/inferno/config/application.rb
inferno_core-0.5.2 lib/inferno/config/application.rb
inferno_core-0.5.1 lib/inferno/config/application.rb
inferno_core-0.5.0 lib/inferno/config/application.rb
inferno_core-0.4.44 lib/inferno/config/application.rb
inferno_core-0.4.43 lib/inferno/config/application.rb
inferno_core-0.4.42 lib/inferno/config/application.rb
inferno_core-0.4.41 lib/inferno/config/application.rb
inferno_core-0.4.40 lib/inferno/config/application.rb