Rails ActiveStorage Using Custom S3 API

做~自己de王妃 提交于 2021-01-28 11:04:57

问题


I want to use Rails ActiveStorage, but I am using non-AWS S3 API object storage.

amazon:
  service: S3
  access_key_id: ""
  secret_access_key: ""
  region: ""
  bucket: ""

On the documentation, it says that we need the region, my S3 API has no region. Is the any way to use custom S3 API?


回答1:


I solved it by using the endpoint key on the configuration file. It look like this.

amazon:
  service: S3
  access_key_id: "123"
  secret_access_key: "asd"
  endpoint: "http://192.168.1.201:30103"
  bucket: "test"

Do not need to use any region since there is not any. I found it at the bottom of the S3 Ruby gem AWS documentation https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html



来源:https://stackoverflow.com/questions/49892083/rails-activestorage-using-custom-s3-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!