3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'app/constraints/simplec/subdomains.rb', line 3
def self.matches?(request)
simplec = request.['HTTP_X_ENGINE'] == 'simplec'
present = request.subdomain.present?
not_admin = request.subdomain != 'admin'
subdomain = Simplec::Subdomain.find_by(name: request.subdomain)
match = simplec || (present && not_admin && subdomain)
if match
Thread.current[:simplec_subdomain] = subdomain
Rails.logger.info "Simplec request received.\n ActionDispatch::Request#original_url: \#{request.original_url}\n Simplec Engine: \#{not_admin}\n LOG\n else\n Rails.logger.info <<-LOG\nSimplec Subdomain '\#{request.subdomain}' was not found.\n ActionDispatch::Request#original_url: \#{request.original_url}\n 'admin' subdomain bypass: \#{!not_admin}\n LOG\n end\n\n match\nend\n"
|