Class: Tana::Configuration::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/tana/configuration/loader.rb

Overview

Handles loading of configuration with environment defaults.

Instance Method Summary collapse

Constructor Details

#initialize(model = Content, environment: ENV) ⇒ Loader

Returns a new instance of Loader.



7
8
9
10
# File 'lib/tana/configuration/loader.rb', line 7

def initialize model = Content, environment: ENV
  @model = model
  @environment = environment
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
# File 'lib/tana/configuration/loader.rb', line 12

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