cloudinary / cloudinary/cloudinary_gem

ActiveStorage Mirror Issue

未关闭
#562 9 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Ruby
星标
420
派生
285
PR 合并指标
30 天内没有已合并 PR

描述

I am trying to set up ActiveStorage mirror so that I can migrate from S3 into my Cloudinary. When I try to run the mirror check and upload, I'm getting an error, "RuntimeError (Must supply cloud_name)"

If I check Cloudinary.config, I get all the correct info:
`#`

But if I check Cloudinary.config.cloud_name, it returns false

If I try to run the mirror command locally, I get a bit more info in that it is confirming the file isn't in my mirror on Cloudinary
`Cloudinary Storage (4.0ms) Checked if file exists at key: 3uxbbrz9kh4mw7iq2z2xzyuo1w2z (no)
Mirror Storage (4.5ms) Mirrored file at key: 3uxbbrz9kh4mw7iq2z2xzyuo1w2z (checksum: DSAVwrDMF+tj9ncc9pCX2A==)
/Users/joshua/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/cloudinary-2.2.0/lib/cloudinary/api.rb:1269:in `call_api': Must supply cloud_name (RuntimeError)`

Any thoughts on why it finds the cloud_name but is returning false when I try to use it?

ruby 3.0.0p0
Rails 7.0.4
cloudinary (2.2.0)
activestorage (7.0.4)

I have tried all manner of configurations, using the cloudinary.yml in the config folder
```
development:
cloud_name: airjoshb
api_key: ENV.fetch('CLOUDINARY_KEY_ID')
api_secret: ENV.fetch('CLOUDINARY_ACCESS_KEY')
enhance_image_tag: true
static_file_support: false

production:
cloud_name: airjoshb
api_key: ENV.fetch('CLOUDINARY_KEY_ID')
api_secret: ENV.fetch('CLOUDINARY_ACCESS_KEY')
enhance_image_tag: true
static_file_support: true
```

In an initializer, cloudinary.rb where the env includes the key:key@cloud_name format
```
require 'cloudinary'

Cloudinary.config_from_url("cloudinary://ENV.fetch('CLOUDINARY_URL')")
Cloudinary.config do |config|
config.secure = true
config.enhance_image_tag = true
config.static_file_support= false
end

```
And, my storage.yml is super simple, as the gem seems to prefer using the initializer
```
cloudinary:
service: Cloudinary
folder: switch-bakery

# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
amazon:
service: S3
access_key_id: <%= ENV.fetch('AWS_ACCESS_KEY_ID') %>
secret_access_key: <%= ENV.fetch('AWS_SECRET_ACCESS_KEY') %>
region: 'us-west-1'
bucket: <%= ENV.fetch('S3_BUCKET_NAME') %>

production:
service: Mirror
primary: amazon
mirrors:
- cloudinary
```

贡献指南

打开贡献指南

调研方向

使用 Ruby 3.0.0、Rails 7.0.4 和 cloudinary 2.2.0 重现 ActiveStorage Mirror 检查和上传。首先将 Cloudinary.config.cloud_name 与 config/initializers/cloudinary.rb 中的 config_from_url 调用,以及 config/storage.yml 中的 Cloudinary 和 Mirror 条目进行比较;当 mirror 上传在没有 “Must supply cloud_name” 错误的情况下完成时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
rails, ruby
领域
backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
30/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。