[ENV] Add fog config
This commit is contained in:
parent
db8e750f1a
commit
296e3a9b09
5 changed files with 29 additions and 18 deletions
|
@ -1,17 +1,18 @@
|
|||
if Rails.env.test?
|
||||
Fog.credentials_path = Rails.root.join('config', 'fog_credentials.test.yml')
|
||||
else
|
||||
Fog.credentials_path = Rails.root.join('config', 'fog_credentials.yml')
|
||||
end
|
||||
|
||||
CarrierWave.configure do |config|
|
||||
# These permissions will make dir and files available only to the user running
|
||||
# the servers
|
||||
config.permissions = 0664
|
||||
config.directory_permissions = 0775
|
||||
|
||||
if Rails.env.production? || Rails.env.staging?
|
||||
config.fog_credentials = { provider: 'OpenStack' }
|
||||
if ENV['FOG_ENABLED'] == 'enabled'
|
||||
config.fog_credentials = {
|
||||
provider: 'OpenStack',
|
||||
openstack_tenant: Rails.application.secrets.fog[:openstack_tenant],
|
||||
openstack_api_key: Rails.application.secrets.fog[:openstack_api_key],
|
||||
openstack_username: Rails.application.secrets.fog[:openstack_username],
|
||||
openstack_auth_url: Rails.application.secrets.fog[:openstack_auth_url],
|
||||
openstack_region: Rails.application.secrets.fog[:openstack_region],
|
||||
}
|
||||
end
|
||||
|
||||
# This avoids uploaded files from saving to public/ and so
|
||||
|
@ -22,11 +23,5 @@ CarrierWave.configure do |config|
|
|||
|
||||
config.fog_public = true
|
||||
|
||||
if Rails.env.production?
|
||||
config.fog_directory = "tps"
|
||||
elsif Rails.env.development?
|
||||
config.fog_directory = "test_local"
|
||||
else
|
||||
config.fog_directory = "tps_dev"
|
||||
end
|
||||
config.fog_directory = Rails.application.secrets.fog[:directory]
|
||||
end
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
STORAGE_URL = "https://storage.apientreprise.fr/#{CarrierWave::Uploader::Base.fog_directory}/"
|
Loading…
Add table
Add a link
Reference in a new issue