From 868decd06eb442f787cd73505f2f684e32670916 Mon Sep 17 00:00:00 2001 From: clemkeirua Date: Tue, 2 Jun 2020 15:03:37 +0200 Subject: [PATCH] add overide for fog openstack v3 --- config/initializers/active_storage.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/config/initializers/active_storage.rb b/config/initializers/active_storage.rb index e20e48620..364050bd0 100644 --- a/config/initializers/active_storage.rb +++ b/config/initializers/active_storage.rb @@ -40,3 +40,26 @@ module Fog::OpenStack::Auth::Catalog end end end + +require 'fog/openstack/auth/catalog/v3' +module Fog::OpenStack::Auth::Catalog + class V3 + def endpoint_url(endpoint, interface) + url = endpoint["#{interface}URL"] + + if interface == 'public' + publicize(url) + else + url + end + end + + private + + def publicize(url) + search = %r{^https://[^/]+/} + replace = "#{ENV['DS_PROXY_URL']}/" + url.gsub(search, replace) + end + end +end