Class: Calicli::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/calicli/configuration.rb', line 16

def initialize
  config_file = "#{Calicli.app_directory}/config.yml"
  if File.exist?(config_file)
    template = ERB.new(File.read(config_file))
    result = YAML.load(template.result(binding))
    @active_record_config = result["active_record_config"]
    @erp_api_base = result["erp_api_base"]
    @erp_api_token = result["erp_api_token"]
    
    @aws_key_id = result["aws_key_id"]
    @aws_secret = result["aws_secret"]
    @aws_bucket = result["aws_bucket"]
    @sqs_key_id = result["sqs_key_id"]
    @sqs_secret = result["sqs_secret"]
    @sqs_queue_url = result["sqs_queue_url"]
    
    QuickStore.configure do |config|
      config.file_path = "#{Calicli.app_directory}/storage.yml"
    end
  else
    raise Calicli::Error, "Configuration is missing. Make sure to create this file: #{config_file}"
  end
end

Instance Attribute Details

#active_record_configObject

Returns the value of attribute active_record_config.



6
7
8
# File 'lib/calicli/configuration.rb', line 6

def active_record_config
  @active_record_config
end

#aws_bucketObject

Returns the value of attribute aws_bucket.



11
12
13
# File 'lib/calicli/configuration.rb', line 11

def aws_bucket
  @aws_bucket
end

#aws_key_idObject

Returns the value of attribute aws_key_id.



9
10
11
# File 'lib/calicli/configuration.rb', line 9

def aws_key_id
  @aws_key_id
end

#aws_secretObject

Returns the value of attribute aws_secret.



10
11
12
# File 'lib/calicli/configuration.rb', line 10

def aws_secret
  @aws_secret
end

#erp_api_baseObject

Returns the value of attribute erp_api_base.



7
8
9
# File 'lib/calicli/configuration.rb', line 7

def erp_api_base
  @erp_api_base
end

#erp_api_tokenObject

Returns the value of attribute erp_api_token.



8
9
10
# File 'lib/calicli/configuration.rb', line 8

def erp_api_token
  @erp_api_token
end

#sqs_key_idObject

Returns the value of attribute sqs_key_id.



12
13
14
# File 'lib/calicli/configuration.rb', line 12

def sqs_key_id
  @sqs_key_id
end

#sqs_queue_urlObject

Returns the value of attribute sqs_queue_url.



14
15
16
# File 'lib/calicli/configuration.rb', line 14

def sqs_queue_url
  @sqs_queue_url
end

#sqs_secretObject

Returns the value of attribute sqs_secret.



13
14
15
# File 'lib/calicli/configuration.rb', line 13

def sqs_secret
  @sqs_secret
end