Skip to content

Commit

Permalink
Set fallback, to fix Heroku pre-compilation (#65)
Browse files Browse the repository at this point in the history
* Set fallback, to fix Heroku precompilation
* Initialize AWS as needed
* Update workflow
  • Loading branch information
forsbergplustwo authored Aug 25, 2023
1 parent 79361d0 commit 14a6f20
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
bin/rake db:migrate
- name: Run tests
env:
AWS_REGION: us-east-1
REDIS_URL: redis://localhost:6379/0
SECRET_KEY_BASE: ${{ secrets.secret_key_base }}
run: |
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/concerns/s3_direct_uploadable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module S3DirectUploadable
private

def set_s3_direct_post
@s3_direct_post = S3_BUCKET.presigned_post(key: "uploads/#{SecureRandom.uuid}/${filename}", success_action_status: "201")
s3 = Aws::S3::Resource.new.bucket(ENV["S3_BUCKET"])
@s3_direct_post = s3.presigned_post(key: "uploads/#{SecureRandom.uuid}/${filename}", success_action_status: "201")
end
end
4 changes: 1 addition & 3 deletions config/initializers/aws.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Aws.config.update({
region: ENV["AWS_REGION"],
region: ENV.fetch("AWS_REGION", "us-east-1"),
credentials: Aws::Credentials.new(ENV["AWS_ACCESS_KEY_ID"], ENV["AWS_SECRET_ACCESS_KEY"])
})

S3_BUCKET = Aws::S3::Resource.new.bucket(ENV["S3_BUCKET"])

0 comments on commit 14a6f20

Please sign in to comment.