Module: Lono::Template::AwsService
- Included in:
- FileUploader, Upload
- Defined in:
- lib/lono/template/aws_service.rb
Instance Method Summary collapse
Instance Method Details
#s3 ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lono/template/aws_service.rb', line 4 def s3 return @s3 if @s3 = {} # allow override of region for s3 client to avoid warning: # S3 client configured for "us-east-1" but the bucket "xxx" is in "us-west-2"; Please configure the proper region to avoid multiple unnecessary redirects and signing attempts # Example: endpoint: 'https://s3.us-west-2.amazonaws.com' settings = Lono::Setting.new.data endpoint = settings["s3_endpoint"] endpoint = ENV['S3_ENDPOINT'] if ENV['S3_ENDPOINT'] [:endpoint] = endpoint if endpoint if [:endpoint] [:region] = [:endpoint].split('.')[1] end @s3 = Aws::S3::Client.new() end |