我预编译资产时,我的asset_sync gem不会上传到s3
asset_sync.rb
if defined?(AssetSync)
AssetSync.configure do |config|
config.fog_provider = 'AWS'
config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
# To use AWS reduced redundancy storage.
# config.aws_reduced_redundancy = true
config.fog_directory = ENV['FOG_DIRECTORY']
# Invalidate a file on a cdn after uploading files
# config.cdn_distribution_id = "12345"
# config.invalidate = ['file1.js']
# Increase upload performance by configuring your region
config.fog_region = 'ap-southeast-2'
#
# Don't delete files from the store
# config.existing_remote_files = "keep"
#
# Automatically replace files with their equivalent gzip compressed version
# config.gzip_compression = true
#
# Use the Rails generated 'manifest.yml' file to produce the list of files to
# upload instead of searching the assets directory.
# config.manifest = true
#
# Fail silently. Useful for environments such as Heroku
# config.fail_silently = true
end
end
production.rb
config.assets.enabled = true
config.assets.digest = true
config.action_controller.asset_host = "//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
config.assets.initialize_on_precompile = true
application.rb中
config.assets.enabled = true
config.assets.digest = true
当我预编译时,我甚至没有收到任何消息,表明它正在上传。
为什么会发生这种情况?
答案 0 :(得分:1)
group :assets do
gem 'asset_sync'
end
你应该把那个宝石从那个组中拿出来
答案 1 :(得分:0)
我知道这个问题很旧...但是我只是继承了一个Heroku应用程序,并且正在阅读如何与Heroku进行asset_sync,并遇到this,该状态指出ENV变量在Heroku上编译资产时不可用。 / p>