Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Carrierwave integration with Selectel using fog-openstack
CarrierWave.configure do |config|
if Rails.env.test? || Rails.env.cucumber?
config.storage = :file
config.enable_processing = false
else
config.asset_host = Rails.application.secrets.asset_host
config.fog_provider = 'fog/openstack'
config.fog_credentials = {
provider: 'OpenStack',
openstack_auth_url: 'https://api.selcdn.ru/v3',
# Create a new user with limited bucket access
openstack_username: Rails.application.secrets.selectel[:username],
# User password, not API key
openstack_api_key: Rails.application.secrets.selectel[:password],
}
# required
config.fog_directory = Rails.application.secrets.selectel_container
# optional, defaults to true
config.fog_public = true
# optional, defaults to {}
config.fog_attributes = {
cache_control: "public, max-age=#{365.days.to_i}"
}
config.storage = :fog
end
end
# paramsv3 = {
# openstack_auth_url: 'https://api.selcdn.ru/v3',
# openstack_username: Rails.application.secrets.selectel[:username],
# openstack_api_key: Rails.application.secrets.selectel[:password],
# }
# paramsv2 = {
# openstack_auth_url: 'https://api.selcdn.ru/v2.0',
# openstack_username: Rails.application.secrets.selectel[:username],
# openstack_api_key: Rails.application.secrets.selectel[:password],
# openstack_identity_api_version: 'v2.0'
# }
# service = Fog::OpenStack::Storage.new(paramsv2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.