From 73d4ecf35dbe9b906eaf3418a05f13120fd012ca Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 30 Oct 2019 16:15:38 +0100 Subject: [PATCH] Add a DS_PROXY_URL env variable --- config/env.example | 1 + config/environments/development.rb | 2 +- config/initializers/active_storage.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/env.example b/config/env.example index 84fd7aeb7..4f704adab 100644 --- a/config/env.example +++ b/config/env.example @@ -24,6 +24,7 @@ FOG_OPENSTACK_REGION="" FOG_DIRECTORY="" FOG_ENABLED="" CARRIERWAVE_CACHE_DIR="/tmp/tps-local-cache" +DS_PROXY_URL="" FC_PARTICULIER_ID="" FC_PARTICULIER_SECRET="" diff --git a/config/environments/development.rb b/config/environments/development.rb index 2a5367e65..385185b36 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -22,7 +22,7 @@ Rails.application.configure do # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false - config.active_storage.service = :local + config.active_storage.service = ENV['FOG_ENABLED'] == 'enabled' ? :openstack : :local # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb index 1d600d89c..dd4d57d48 100644 --- a/config/initializers/active_storage.rb +++ b/config/initializers/active_storage.rb @@ -32,7 +32,7 @@ module Fog::OpenStack::Auth::Catalog def publicize(url) search = %r{^https://[^/]+/} - replace = 'https://static.demarches-simplifiees.fr/' + replace = "#{ENV['DS_PROXY_URL']}/" url.gsub(search, replace) end end