Module: AwsTranslationHelper

Included in:
Api::V5::ReviewsController, Translations::AwsTranslateService
Defined in:
app/helpers/aws_translation_helper.rb

Instance Method Summary collapse

Instance Method Details

#aws_translate_clientObject



2
3
4
5
6
7
8
9
10
11
12
13
# File 'app/helpers/aws_translation_helper.rb', line 2

def aws_translate_client
  if IS_PRODUCTION_ENV
    # we use IAM Roles for EC2, so we don't need to pass credentials
    Aws::Translate::Client.new(region: Figaro.env.AWS_TRANSLATE_REGION!)
  else
    Aws::Translate::Client.new(
      region: Figaro.env.AWS_TRANSLATE_REGION!,
      access_key_id: Figaro.env.AWS_TRANSLATE_ACCESS_KEY_ID!,
      secret_access_key: Figaro.env.AWS_TRANSLATE_SECRET_KEY!,
    )
  end
end