2018-11-13 18:25:06 +01:00
|
|
|
module Fog
|
|
|
|
module ServicesMixin
|
|
|
|
private
|
|
|
|
|
|
|
|
def require_service_provider_library(service, provider)
|
|
|
|
# Monkey patch to fix https://github.com/fog/fog/issues/4014
|
|
|
|
|
|
|
|
# This method exists in fog to load legacy providers that have not yet been extracted to
|
|
|
|
# their own gem.
|
|
|
|
# fog-openstack has been extracted to its own gem and does not need this method.
|
|
|
|
# Furthermore, fog-openstack has recently been refactored in a way that breaks this method.
|
|
|
|
#
|
|
|
|
# Therefore, until either fog or fog-openstack fixes the problem, we have to neuter the method.
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-05-13 16:08:51 +02:00
|
|
|
CarrierWave.configure do |config|
|
|
|
|
# These permissions will make dir and files available only to the user running
|
|
|
|
# the servers
|
2016-05-24 14:25:40 +02:00
|
|
|
config.permissions = 0664
|
|
|
|
config.directory_permissions = 0775
|
2016-05-13 16:08:51 +02:00
|
|
|
|
2018-11-13 17:51:13 +01:00
|
|
|
config.fog_provider = 'fog/openstack'
|
|
|
|
|
2018-08-22 17:36:15 +02:00
|
|
|
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],
|
2018-11-13 18:25:06 +01:00
|
|
|
openstack_region: Rails.application.secrets.fog[:openstack_region],
|
|
|
|
openstack_identity_api_version: Rails.application.secrets.fog[:oopenstack_identity_api_version]
|
2018-08-22 17:36:15 +02:00
|
|
|
}
|
2016-05-13 16:08:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
# This avoids uploaded files from saving to public/ and so
|
|
|
|
# they will not be available for public (non-authenticated) downloading
|
|
|
|
config.root = Rails.root
|
|
|
|
|
2018-03-06 13:44:29 +01:00
|
|
|
config.cache_dir = Rails.root.join("uploads")
|
2016-05-13 16:08:51 +02:00
|
|
|
|
|
|
|
config.fog_public = true
|
|
|
|
|
2018-08-22 17:36:15 +02:00
|
|
|
config.fog_directory = Rails.application.secrets.fog[:directory]
|
2016-05-13 16:08:51 +02:00
|
|
|
end
|