Skip to content

Commit

Permalink
Merge pull request #534 from commercekitchen/develop
Browse files Browse the repository at this point in the history
CloudFront Lessons
  • Loading branch information
tmichaelreis authored Sep 2, 2021
2 parents 684cffc + 6db9368 commit 3a8580a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
1 change: 1 addition & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
### S3 Configuration ###
config.lesson_store = :s3

config.cloudfront_url = 'https://d1j5ysqdewbwao.cloudfront.net'
config.zip_bucket_name = 'dl-prodapp-lessons-zipped'
config.s3_bucket_name = 'dl-prodapp-lessons'

Expand Down
1 change: 1 addition & 0 deletions config/environments/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
### S3 Configuration ###
config.lesson_store = :s3

config.cloudfront_url = 'https://dmx80r2ae8pd1.cloudfront.net'
config.zip_bucket_name = 'dl-stageapp-lessons-zipped'
config.s3_bucket_name = 'dl-stageapp-lessons'

Expand Down
10 changes: 3 additions & 7 deletions lib/s3_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def perform_request(env)

# use rack proxy for anything hitting our host app at /example_service
if use_s3? && request.path =~ %r{^/storylines}
@backend = URI("https://#{s3_bucket_name}.s3-#{s3_region}.amazonaws.com")
@backend = URI(cloudfront_url)

# most backends required host set properly, but rack-proxy doesn't set this for you automatically
# even when a backend host is passed in via the options
Expand All @@ -32,11 +32,7 @@ def use_s3?
Rails.configuration.lesson_store == :s3
end

def s3_bucket_name
Rails.configuration.s3_bucket_name
end

def s3_region
Rails.configuration.s3_region
def cloudfront_url
Rails.configuration.cloudfront_url
end
end

0 comments on commit 3a8580a

Please sign in to comment.