使用 Heroku 上的暂存实例进行 Carrierwave 存储路径管理

发布于 2024-12-05 22:26:54 字数 422 浏览 4 评论 0原文

我在 Heroku 上有两个正在生产的应用程序实例:staging.myapp.comwww.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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

霞映澄塘 2024-12-12 22:26:54

我将我的资产放在不同的桶中,并这样做;

config.fog_directory  = "myappname-#{Rails.env}-assets"

因此它将使用存储桶名称 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;

config.fog_directory  = "myappname-#{Rails.env}-assets"

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'

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文