introduced ability to auto detect CNAME of custom domain
This commit is contained in:
parent
a612c2e5ea
commit
b1624a6812
5 changed files with 41 additions and 8 deletions
|
|
@ -92,6 +92,28 @@ class Conference < ActiveRecord::Base
|
|||
user.present? && registrations.where(user_id: user.id).count > 0
|
||||
end
|
||||
|
||||
##
|
||||
# Checks if domain correctly points to the hosted version
|
||||
# This feature is enabled only if ENV['OSEM_HOSTNAME'] is present
|
||||
#
|
||||
# ====Returns
|
||||
# * +true+ -> If the custom domain has a CNAME record for the hosted version
|
||||
# * +false+ -> If the custom domain does not have a CNAME record for the hosted version
|
||||
def check_custom_domain
|
||||
require 'resolv'
|
||||
|
||||
unless ENV['OSEM_HOSTNAME'].nil?
|
||||
cname_record = Resolv::DNS.new.getresources(custom_domain, Resolv::DNS::Resource::IN::CNAME)
|
||||
if cname_record.present?
|
||||
return ENV['OSEM_HOSTNAME'] == Resolv::DNS.new.getresources(custom_domain, Resolv::DNS::Resource::IN::CNAME).first.name.to_s
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
'--feature disabled--'
|
||||
end
|
||||
|
||||
##
|
||||
# Delete all EventSchedules that are not in the hours range
|
||||
# After the conference has been successfully updated
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue