使用 Heroku 上的暂存实例进行 Carrierwave 存储路径管理
我在 Heroku 上有两个正在生产的应用程序实例:staging.myapp.com
和 www.myapp.com
,并且我遵循以下工作流程:Heroku 上的暂存实例。 由于我将 Carrierwave 与 AWS S3 一起使用,我想知道是否可以修改存储路径以指定每个实例,例如:
def store_dir
instance = "staging" | "production"
#{instance}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}
end
I have two instances of my app in production on Heroku, staging.myapp.com
and www.myapp.com
, and I am following this workflow: Staging instance on Heroku.
As I am using Carrierwave with AWS S3, I would like to know if it is possible to modify the storage path in order to specify each instance, e.g.:
def store_dir
instance = "staging" | "production"
#{instance}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将我的资产放在不同的桶中,并这样做;
因此它将使用存储桶名称 myappname-product-assets 或 myappname-staging-assets。
在我的载波初始值设定项中。请务必阅读 https://github.com/jnicklas/rierwave 上的“配置 Carrierwave”和“使用亚马逊S3'
I keep my assets in seperate buckets and do it like this;
so it will use a bucket name myappname-production-assets or myappname-staging-assets.
in my carrierwave initializer. Make sure you read 'Configuring Carrierwave' on https://github.com/jnicklas/carrierwave and 'Using Amazon S3'