Use an env var for Carrierwave's cache_dir
This commit is contained in:
parent
e93f57763e
commit
b2dc502ed5
4 changed files with 7 additions and 16 deletions
|
@ -1,9 +1,5 @@
|
|||
class BaseUploader < CarrierWave::Uploader::Base
|
||||
def cache_dir
|
||||
if Rails.env.production?
|
||||
'/tmp/tps-cache'
|
||||
else
|
||||
'/tmp/tps-dev-cache'
|
||||
end
|
||||
Rails.application.secrets.carrierwave[:cache_dir]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,7 @@ FOG_OPENSTACK_AUTH_URL=""
|
|||
FOG_OPENSTACK_REGION=""
|
||||
FOG_DIRECTORY=""
|
||||
FOG_ENABLED=""
|
||||
CARRIERWAVE_CACHE_DIR="/tmp/tps-local-cache"
|
||||
|
||||
CLEVER_CLOUD_ACCESS_KEY_ID=""
|
||||
CLEVER_CLOUD_SECRET_ACCESS_KEY=""
|
||||
|
|
|
@ -40,6 +40,8 @@ defaults: &defaults
|
|||
openstack_auth_url: <%= ENV['FOG_OPENSTACK_AUTH_URL'] %>
|
||||
openstack_region: <%= ENV['FOG_OPENSTACK_REGION'] %>
|
||||
directory: <%= ENV['FOG_DIRECTORY'] %>
|
||||
carrierwave:
|
||||
cache_dir: <%= ENV['CARRIERWAVE_CACHE_DIR'] %>
|
||||
mailtrap:
|
||||
username: <%= ENV['MAILTRAP_USERNAME'] %>
|
||||
password: <%= ENV['MAILTRAP_PASSWORD'] %>
|
||||
|
@ -60,6 +62,8 @@ test:
|
|||
key: api_entreprise_test_key
|
||||
fog:
|
||||
directory: tps_dev
|
||||
carrierwave:
|
||||
cache_dir: /tmp/tps-test-cache
|
||||
pipedrive:
|
||||
key: pipedrive_test_key
|
||||
france_connect_particulier:
|
||||
|
|
|
@ -6,16 +6,6 @@ describe BaseUploader do
|
|||
describe '#cache_dir' do
|
||||
subject { uploader.cache_dir }
|
||||
|
||||
context 'when rails env is not production' do
|
||||
it { is_expected.to eq '/tmp/tps-dev-cache' }
|
||||
end
|
||||
|
||||
context 'when rails env is not production' do
|
||||
before do
|
||||
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production"))
|
||||
end
|
||||
|
||||
it { is_expected.to eq '/tmp/tps-cache' }
|
||||
end
|
||||
it { is_expected.to eq '/tmp/tps-test-cache' }
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue