繁体   English   中英

有没有办法检查回形针宝石使用的 URL?

[英]Is there a way to examine the URL used by the paperclip gem?

我正在使用带有 rails 4.2 和 MinIO 的 kreeti/kt-paperclip gem。 我相信我已经正确设置了模型,但我收到“Aws::S3::Errors::InvalidAccessKeyId:您提供的 AWS 访问密钥 ID 在我们的记录中不存在。” 我进行了验证路径和凭据的测试。 我想知道 gem 是在使用我的本地 MinIO 服务器还是正在尝试访问 AWS。 有没有办法不使用数据包嗅探器来验证它是否正在尝试使用正确的 S3 服务?

has_attached_file :attachment, path: "submission/attachments/:id/:basename.:extension",
    storage: :s3, s3_credentials: Proc.new{|a| a.instance.s3_credentials }, url: ":s3_path_url"
def s3_credentials
    {
      bucket: "bucket_name",
      access_key_id: "MYKEY",
      secret_access_key: "MYSECRET,
      s3_region: "us-west-1",
      s3_protocol: "http",
      s3_host_name: "play.minio.io:9000"
    }
  end

我在 MinIO 文档网站上偶然发现了答案。 https://docs.min.io/docs/how-to-use-paperclip-with-minio-server.html

首先,我将选项放入凭据中,这是不对的。 此外还有其他选项。

  has_attached_file :attachment,
                    storage: :s3,
                    s3_protocol: ':http',
                    s3_permissions: 'public',
                    s3_region: 'us-west-1',
                    s3_credentials: {
                      bucket: 'bucket_name',
                      access_key_id: 'MYKEY',
                      secret_access_key: 'MYSECRET',
                    },
                    s3_host_name: 'play.minio.io:9000',
                    s3_options: {
                      endpoint: "http://play.minio.io:9000",
                      force_path_style: true
                    },
                    url: ":s3_path_url",
                    path: "submission/attachments/:id/:basename.:extension"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM