Make the AWS code a smidge more robust
This commit is contained in:
parent
23e4f02538
commit
9ebb9f0c9b
@ -4,14 +4,21 @@ def main
|
|||||||
bucket = ENV.fetch('CPI_FEED_AWS_BUCKET')
|
bucket = ENV.fetch('CPI_FEED_AWS_BUCKET')
|
||||||
key = ARGV.first || ENV.fetch('CPI_FEED_AWS_KEY')
|
key = ARGV.first || ENV.fetch('CPI_FEED_AWS_KEY')
|
||||||
|
|
||||||
puts Aws::S3::Resource.new.bucket(bucket).object(key).put(
|
Aws::S3::Resource.new.bucket(bucket).object(key).put(
|
||||||
body: $stdin.read
|
body: $stdin.read
|
||||||
)
|
).on_success do |response|
|
||||||
|
puts response.data
|
||||||
|
|
||||||
puts Aws::S3::Client.new.put_object_acl(
|
Aws::S3::Client.new.put_object_acl(
|
||||||
bucket: bucket, key: key, acl: 'public-read'
|
bucket: bucket, key: key, acl: 'public-read'
|
||||||
)
|
).on_success do |acl_response|
|
||||||
0
|
puts acl_response.data
|
||||||
|
end
|
||||||
|
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
|
1
|
||||||
end
|
end
|
||||||
|
|
||||||
exit(main) if $PROGRAM_NAME == __FILE__
|
exit(main) if $PROGRAM_NAME == __FILE__
|
||||||
|
Loading…
Reference in New Issue
Block a user