From 3018043fc2b405e42070b49e965bc7a0a38ecf2a Mon Sep 17 00:00:00 2001 From: Patrick Figel Date: Mon, 11 Sep 2017 15:11:13 +0200 Subject: Add OpenStack Keystone V3 support (#4889) Keystone V2 is deprecated in favour of V3. This adds the necessary connection parameters for establishing a V3 connection. Connections to V2 endpoints are still possible and the configuration should remain compatible. This also introduces a SWIFT_REGION variable for multi-region OpenStack environments and a SWIFT_CACHE_TTL that controls how long tokens and other meta-data is cached for. Caching tokens avoids rate-limiting errors that would result in media uploads becoming unavailable during high load or when using tasks like media:remove_remote. fog-openstack only supports token caching for V3 endpoints, so a recommendation for using V3 was added. --- config/initializers/paperclip.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'config/initializers/paperclip.rb') diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index e9f455251..f27aae7ec 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -47,9 +47,12 @@ elsif ENV['SWIFT_ENABLED'] == 'true' fog_credentials: { provider: 'OpenStack', openstack_username: ENV.fetch('SWIFT_USERNAME'), - openstack_tenant: ENV.fetch('SWIFT_TENANT'), + openstack_project_name: ENV.fetch('SWIFT_TENANT'), openstack_api_key: ENV.fetch('SWIFT_PASSWORD'), openstack_auth_url: ENV.fetch('SWIFT_AUTH_URL'), + openstack_domain_name: ENV['SWIFT_DOMAIN_NAME'] || 'default', + openstack_region: ENV['SWIFT_REGION'], + openstack_cache_ttl: ENV['SWIFT_CACHE_TTL'] || 60, }, fog_directory: ENV.fetch('SWIFT_CONTAINER'), fog_host: ENV.fetch('SWIFT_OBJECT_URL'), -- cgit