我在使用空间将我的 rails 6 应用程序部署到 Digital Ocean 时遇到问题。部署后,网络服务器失败。在 Puma 日志中,我发现:
Unable to load application: Aws::Sigv4::Errors::MissingCredentialsError: missing credentials, provide credentials with one of the following options:
Feb 05 03:33:25: - :access_key_id and :secret_access_key
Feb 05 03:33:25: - :credentials
Feb 05 03:33:25: - :credentials_provider
这是我的相关导轨设置:
宝石文件
gem 'aws-sdk-s3'
配置/存储.yml
digitalocean_spaces:
service: S3
access_key_id: <%= Rails.application.credentials.dig(:digitalocean_spaces, :access_key_id) %>
secret_access_key: <%= Rails.application.credentials.dig(:digitalocean_spaces, :secret_access_key) %>
region: nyc3
endpoint: 'https://nyc3.digitaloceanspaces.com'
bucket: foobar-bucket
环境/生产.rb
config.active_storage.service = :digitalocean_spaces
凭证.yml.enc
digitalocean_spaces:
access_key_id: foobar
secret_access_key: secretfoobar