update license

This commit is contained in:
Thein Lin Kyaw
2020-01-23 11:33:02 +06:30
parent 12941cfe66
commit eb2db57d91
2 changed files with 64 additions and 61 deletions

View File

@@ -4,9 +4,8 @@ class ActionController::Base
private
def lookup_domain
if request.subdomain.present? && request.subdomain != "www" && ENV["SERVER_MODE"] == "cloud"
from = request.host
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
if request.subdomains.last && request.subdomains.last != "www" && ENV["SERVER_MODE"] == "cloud"
@license = cache_license(ENV["SX_PROVISION_URL"], request.host) # request.subdomain.downcase
if (!@license.nil?)
logger.info "Location - " + @license.dbschema
ActiveRecord::Base.establish_connection(website_connection(@license))
@@ -18,7 +17,7 @@ class ActionController::Base
# redirect_to root_url(:host => request.domain) + "store_error"
render :json => [{ status: false, message: 'Invalid Access!'}]
end
elsif request.subdomain.present? && request.subdomain != "www" || ENV["SERVER_MODE"] == "application"
elsif request.subdomains.last && request.subdomains.last != "www" || ENV["SERVER_MODE"] == "application"
# check for license file
if check_license(request.host)
current_license(ENV["SX_PROVISION_URL"], request.host)
@@ -102,9 +101,8 @@ class ActionController::API
private
def lookup_domain
if request.subdomain.present? && request.subdomain != "www" && ENV["SERVER_CODE"] == "cloud"
from = request.host
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
if request.subdomains.last && request.subdomains.last != "www" && ENV["SERVER_CODE"] == "cloud"
@license = cache_license(ENV["SX_PROVISION_URL"], request.host) # request.subdomain.downcase
if (!@license.nil?)
logger.info "Location - " + @license.dbschema
ActiveRecord::Base.establish_connection(website_connection(@license))