license and local move to base action and update other base

This commit is contained in:
Yan
2018-02-27 11:41:24 +06:30
parent 13b7b1f800
commit ac470c5747
9 changed files with 77 additions and 64 deletions

View File

@@ -1,17 +1,15 @@
# ActionController::Base are used by both Peatio controllers and
# Doorkeeper controllers.
class ActionController::Base
before_action :lookup_domain, :set_language
before_action :lookup_domain, :set_locale
private
def lookup_domain
def lookup_domain
if request.subdomain.present? && request.subdomain != "www"
from = request.subdomain.downcase + "." + request.domain.downcase
@license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase
if (!@license.nil?)
# logger.info "Location - " + @license.name
logger.info "Location - " + @license.dbhost
ActiveRecord::Base.establish_connection(website_connection(@license))
# authenticate_session_token
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema