所以在我的本地主机上,当我上传照片并检查 url 时,它们被保存到 s3。当我在 heroku 上执行相同操作时,文件会本地保存到应用程序中。这是我的heroku env vars:
=== boundarystaging Config Vars
AWS_ACCESS_KEY_ID: xxxxxxxxxxx
AWS_BUCKET_NAME: xxxxxxxxx.s3-website-us-west-2.amazonaws.com
AWS_SECRET_ACCESS_KEY: xxxxxxxxxxxxxxxxxx
DATABASE_URL: postgres://ukbcnhkvbcznkw:s9ENAi7XVUeV- LiMv4FiC2CT6n@ec2-54-243-178-223.compute-1.amazonaws.com:5432/d89nireva8vtl3
GEM_PATH: vendor/bundle/ruby/1.9.1
HEROKU_POSTGRESQL_IVORY_URL: postgres://ukbcnhkvbcznkw:s9ENAi7XVUeV- LiMv4FiC2CT6n@ec2-54-243-178-223.compute-1.amazonaws.com:5432/d89nireva8vtl3
HEROKU_URL: http://boundarystaging.herokuapp.com
HUBOT_CAMPFIRE_TOKEN: 4d1caffdecf1ba19168cdb27eb75673ddf4979c3
LANG: en_US.UTF-8
RACK_ENV: staging
RAILS_ENV: staging
S3_BUCKET_NAME: xxxxxxxxx.s3-website-us-west-2.amazonaws.com
很明显,我把我所有的钥匙都拿出来了。我只是不明白为什么照片不会保存到我的登台服务器上的 s3。为了比较,这是我的产品变量:
=== boundaryprod Config Vars
AWS_ACCESS_KEY_ID: xxxxxxxxxxxxxxxx
AWS_BUCKET: xxxxxxxxxxxxxx.s3-website-us-west- 2.amazonaws.com
AWS_SECRET_ACCESS_KEY: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
DATABASE_URL: postgres://pwwxmdmnvciedi:D9td9clWzUObF3lW4ajNJVK30F@ec2-54-227-238-25.compute- 1.amazonaws.com:5432/d73ap5ocubncpl
HEROKU_POSTGRESQL_IVORY_URL: postgres://pwwxmdmnvciedi:D9td9clWzUObF3lW4ajNJVK30F@ec2-54-227-238-25.compute- 1.amazonaws.com:5432/d73ap5ocubncpl
这些照片可以很好地保存在 prod 应用程序上。两者都在 Heroku 上。有任何想法吗?