Skip to content

Commit

Permalink
fix cloudflare r2 env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmeurer committed Sep 6, 2023
1 parent 9bd79e4 commit bf26fde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
Rails.application.routes.draw do
mount Sidekiq::Web => "sidekiq"

get ":sitemap", sitemap: /sitemap[A-Za-z\d.]*/, to: redirect { "https://#{ENV.fetch "CLOUDFLARE_R2_BUCKET_URL"}#{_2.path}" }
if asset_host = ENV["ASSET_HOST"]
get ":sitemap", sitemap: /sitemap[A-Za-z\d.]*/, to: redirect { "#{asset_host}#{_2.path}" }
end

root "gemmies#index"

Expand Down
2 changes: 1 addition & 1 deletion config/sitemap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

SitemapGenerator::Sitemap.default_host = Rails.application.routes.url_helpers.root_url
SitemapGenerator::Sitemap.adapter = SitemapGenerator::AwsSdkAdapter.new(
ENV.fetch("CLOUDFLARE_R2_BUCKET"),
ENV.fetch("CLOUDFLARE_R2_BUCKET_ASSETS"),
access_key_id: ENV.fetch("CLOUDFLARE_R2_ACCESS_KEY_ID"),
secret_access_key: ENV.fetch("CLOUDFLARE_R2_SECRET_ACCESS_KEY"),
endpoint: "https://#{ENV.fetch "CLOUDFLARE_ACCOUNT_ID"}.r2.cloudflarestorage.com",
Expand Down

0 comments on commit bf26fde

Please sign in to comment.