-
-
Save achempion/838808200ec44154cc3f50124126f4cf to your computer and use it in GitHub Desktop.
Carrierwave integration with Selectel using fog-openstack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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