【发布时间】:2016-04-01 14:48:18
【问题描述】:
我正在尝试将 aws s3 与 heroku 和回形针 gem 一起使用。
在运行git push heroku master 时,我不断收到此语法错误(我隐藏了访问密钥)
# Command Line
remote: SyntaxError: /tmp/build_f1b59509e4d703e2f559ca42123c2f30/config/environments/production.rb:84: syntax error, unexpected tSYMBEG, expecting '}'
remote: :access_key_id = ENV['access_key'],
remote: ^
remote: /tmp/build_f1b59509e4d703e2f559ca42123c2f30/config/environments/production.rb:85: syntax error, unexpected '=>', expecting :: or '[' or '.'
remote: :secret_access_key = ENV['secret_key']
remote: ^
remote: /tmp/build_f1b59509e4d703e2f559ca42123c2f30/config/environments/production.rb:86: syntax error, unexpected '}', expecting keyword_end
Heroku 开发中心指示我使用如下所示的代码。https://devcenter.heroku.com/articles/paperclip-s3
# config/environments/production.rb
config.paperclip_defaults = {
:storage => :s3,
:s3_credentials => {
:bucket => ENV['S3_BUCKET_NAME'],
:access_key_id => ENV['AWS_ACCESS_KEY_ID'],
:secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
}
}
我已尝试更改语法,但我无处可去。如果您对如何将回形针宝石图像保存到 s3 存储桶有任何其他建议,请告诉我。谢谢。
【问题讨论】:
-
您是否在 Heroku 应用程序中设置了 ENV?
-
是的,它已设置为生产
-
你试过没有 ENV 吗?
-
该代码会是什么样子?
标签: ruby-on-rails heroku amazon-s3 paperclip