Cloudflare R2 specific ActiveStorage service

Since R2 is an “S3 compatible”-flavored service, I’m not sure that it’s necessary to introduce a new Active Storage service class for it (unless there’s a compelling requirement that I’m missing). I tend to think about Rails contributions as: “What’s the minimal change needed to Rails for me to be able to ship a valuable gem/railtie/engine that doesn’t need to monkeypatch Rails code?” Or the alternative “… in order to be able to document this configuration in the Rails Guide?”

Looking at the code you provided, it seems like most of the changes can be made through the configuration parameters in config/storage.yml. But the “custom domain” behavior might be something that would be valuable to upstream (my mental models may be ill-formed, but it could be a new config param that defaults to the current behavior).

There is some prior art that seems related:

I’m not a core team member, so take all of this as just one person’s opinion.