Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #66 from diffux/fix-duplicate-bucket
Browse files Browse the repository at this point in the history
Make s3 bucket name configurable
  • Loading branch information
lencioni committed Nov 1, 2015
2 parents 863e7c8 + 07806f0 commit b34efe5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ viewports:
height: 444
s3_access_key_id: <your acccess key id>
s3_secret_access_key: <your secret acccess key>
s3_bucket_name: <a globally unique bucket name>
```
## Command line tools
Expand All @@ -161,8 +162,8 @@ and you can do use your developer tools to debug.
### `diffux upload_diffs`

Uploads all current diff images to an Amazon S3 account and reports back URLs
to access those diff images. Requires the `s3_access_key_id` and
`s3_secret_access_key` configuration options.
to access those diff images. Requires the `s3_access_key_id`,
`s3_secret_access_key`, and `s3_bucket_name` configuration options.

### `diffux clean`

Expand Down
7 changes: 3 additions & 4 deletions lib/diffux_ci_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
require 'securerandom'

class DiffuxCIUploader
BUCKET_NAME = 'diffux_ci-diffs'

def initialize
@s3_access_key_id = DiffuxCIUtils.config['s3_access_key_id']
@s3_secret_access_key = DiffuxCIUtils.config['s3_secret_access_key']
@s3_bucket_name = DiffuxCIUtils.config['s3_bucket_name']
end

def upload_diffs
Expand Down Expand Up @@ -42,10 +41,10 @@ def upload_diffs
def find_or_build_bucket
service = S3::Service.new(access_key_id: @s3_access_key_id,
secret_access_key: @s3_secret_access_key)
bucket = service.buckets.find(BUCKET_NAME)
bucket = service.buckets.find(@s3_bucket_name)

if bucket.nil?
bucket = service.buckets.build(BUCKET_NAME)
bucket = service.buckets.build(@s3_bucket_name)
bucket.save(location: :us)
end

Expand Down

0 comments on commit b34efe5

Please sign in to comment.