Class: ExercismConfig::GenerateAwsSettings

Inherits:
Object
  • Object
show all
Includes:
Mandate
Defined in:
lib/exercism_config/generate_aws_settings.rb

Instance Method Summary collapse

Instance Method Details

#aws_access_key_idObject



15
16
17
# File 'lib/exercism_config/generate_aws_settings.rb', line 15

def aws_access_key_id
  Exercism.env.production? ? nil : 'FAKE'
end

#aws_secret_access_keyObject



20
21
22
# File 'lib/exercism_config/generate_aws_settings.rb', line 20

def aws_secret_access_key
  Exercism.env.production? ? nil : 'FAKE'
end

#callObject



5
6
7
8
9
10
11
12
# File 'lib/exercism_config/generate_aws_settings.rb', line 5

def call
  {
    region: 'eu-west-2',
    endpoint: endpoint,
    access_key_id: aws_access_key_id,
    secret_access_key: aws_secret_access_key
  }.select { |_k, v| v }
end

#endpointObject



25
26
27
28
29
30
31
# File 'lib/exercism_config/generate_aws_settings.rb', line 25

def endpoint
  return nil if Exercism.env.production?
  return "http://127.0.0.1:#{ENV['AWS_PORT']}" if Exercism.env.test? && ENV['EXERCISM_CI']

  host = ENV['EXERCISM_DOCKER'] ? 'aws:3040' : 'localhost:3040'
  "http://#{host}"
end