Class: Gitlab::Pages::VirtualHostFinder
- Inherits:
-
Object
- Object
- Gitlab::Pages::VirtualHostFinder
- Defined in:
- lib/gitlab/pages/virtual_host_finder.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(host) ⇒ VirtualHostFinder
constructor
A new instance of VirtualHostFinder.
Constructor Details
#initialize(host) ⇒ VirtualHostFinder
Returns a new instance of VirtualHostFinder.
6 7 8 |
# File 'lib/gitlab/pages/virtual_host_finder.rb', line 6 def initialize(host) @host = host&.downcase end |
Instance Method Details
#execute ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gitlab/pages/virtual_host_finder.rb', line 10 def execute return if host.blank? gitlab_host = ::Gitlab.config.pages.host.downcase.prepend(".") if host.ends_with?(gitlab_host) name = host.delete_suffix(gitlab_host) by_unique_domain(name) || by_namespace_domain(name) else by_custom_domain(host) end end |