0
フィガロを使用してTravisとAWS S3を連携させようとすると、私は完全に詰まってしまった。Rails - Travis CIがS3資格情報を把握できない
このすべては、DEVモードで正常に動作します:
picture.rb
class Picture < ApplicationRecord
acts_as_list
belongs_to :imageable, polymorphic: true
has_attached_file :image,
:storage => :s3,
:bucket => Figaro.env.s3_bucket,
:s3_region => 'eu-west-1',
:s3_credentials => {
:access_key_id => Figaro.env.aws_access_key_id,
:secret_access_key => Figaro.env.aws_secret_access_key
}
do_not_validate_attachment_file_type :image
end
application.yml
aws_access_key_id: 'xxx'
aws_secret_access_key: 'xxx'
aws_region: 'eu-west-1'
development:
s3_bucket: 'company-name-dev'
production:
s3_bucket: 'company-name-prod'
は明らかトラヴィスは、これらのキーにアクセスする必要がある:
.travis
language: ruby
before_install:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
rvm:
- 2.4.0
bundler_args: "--jobs=2"
script:
- bundle exec rake db:setup
- bundle exec rake spec
cache: bundler
services:
- postgresql
addons:
postgresql: '9.4'
deploy:
provider: heroku
api_key:
secure: verlongherokukey
app: imkerij
on:
repo: MyGitHub/MyRepoName
skip_cleanup: true
env:
matrix:
- s3_bucket='company-name-dev'
global:
- secure: verylongkey
- secure: anotherverylongkey
.yml私はAWS欠落している資格情報のエラーやトラビスでフィガロMissingKeysエラーを取得し続けます。
Figaro.require_keys("aws_access_key_id", "aws_secret_access_key")
を私はAWSの資格情報は、すべての時間を逃すか何かだその前に:だけ追加した後、ところで起こっ
Figaro::MissingKeys: Missing required configuration keys: ["aws_access_key_id", "aws_secret_access_key"]
。
キーが通過していないようです。 また、ENV形式を使用して書き込む際には使用しません。それでは、開発のものでさえ、もはや動作しません。
ご協力いただければ幸いです。私は数日間立ち往生した。 また別の解決策、私は感謝する秘密を使用しています。