diff --git a/config/routes.rb b/config/routes.rb index be32aca..f0a06f8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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" diff --git a/config/sitemap.rb b/config/sitemap.rb index 46ae4c1..28e4d60 100644 --- a/config/sitemap.rb +++ b/config/sitemap.rb @@ -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",