Merge pull request #2512 from betagouv/envs-cleanup

Envs cleanup
This commit is contained in:
gregoirenovel 2018-09-04 16:23:27 +02:00 committed by GitHub
commit 12014fb553
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 17 deletions

View file

@ -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

View file

@ -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=""

View file

@ -26,7 +26,7 @@ Flipflop.configure do
feature :remote_storage,
default: ENV['FOG_ENABLED'] == 'enabled'
feature :weekly_overview,
default: Rails.env.production?
default: ENV['APP_NAME'] == 'tps'
end
feature :pre_maintenance_mode

View file

@ -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:

View file

@ -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