Sha256: 86a25efb484d30560aff89916c197c4da5f2a4d3506be86cee4f1fec28a520d1

Contents?: true

Size: 622 Bytes

Versions: 13

Compression:

Stored size: 622 Bytes

Contents

# frozen_string_literal: true

module Tana
  module Configuration
    # Handles loading of configuration with environment defaults.
    class Loader
      def initialize model = Content, environment: ENV
        @model = model
        @environment = environment
      end

      def call
        model[
          accept: environment.fetch("TANA_API_ACCEPT", "application/json"),
          token: environment["TANA_API_TOKEN"],
          url: environment.fetch("TANA_API_URL", "https://europe-west1-tagr-prod.cloudfunctions.net")
        ]
      end

      private

      attr_reader :model, :environment
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tana-0.14.0 lib/tana/configuration/loader.rb
tana-0.13.0 lib/tana/configuration/loader.rb
tana-0.12.0 lib/tana/configuration/loader.rb
tana-0.11.0 lib/tana/configuration/loader.rb
tana-0.10.0 lib/tana/configuration/loader.rb
tana-0.9.0 lib/tana/configuration/loader.rb
tana-0.8.0 lib/tana/configuration/loader.rb
tana-0.7.0 lib/tana/configuration/loader.rb
tana-0.6.0 lib/tana/configuration/loader.rb
tana-0.4.0 lib/tana/configuration/loader.rb
tana-0.3.0 lib/tana/configuration/loader.rb
tana-0.2.0 lib/tana/configuration/loader.rb
tana-0.1.0 lib/tana/configuration/loader.rb