diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0966a573..36d3ab43 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -27,8 +27,9 @@ class ApplicationController < ActionController::Base 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.name ActiveRecord::Base.establish_connection(website_connection(@license)) + authentication # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema else # reconnect_default_db @@ -38,11 +39,11 @@ class ApplicationController < ActionController::Base end else # check for license file - if check_license - current_license(ENV["SX_PROVISION_URL"]) - else - redirect_to activate_path - end + # if check_license + # current_license(ENV["SX_PROVISION_URL"]) + # else + # redirect_to activate_path + # end end end diff --git a/app/controllers/concerns/login_verification.rb b/app/controllers/concerns/login_verification.rb index ab5823de..6e9cff8d 100755 --- a/app/controllers/concerns/login_verification.rb +++ b/app/controllers/concerns/login_verification.rb @@ -2,7 +2,7 @@ module LoginVerification extend ActiveSupport::Concern included do - before_action :authenticate + # before_action :authenticate helper_method :current_company,:current_login_employee end @@ -10,7 +10,7 @@ module LoginVerification protected # Authenticate the user with token based authentication - def authenticate + def authenticate authenticate_session_token || render_unauthorized end @@ -18,7 +18,7 @@ module LoginVerification token = session[:session_token] if (token) #@current_user = User.find_by(api_key: token) - Rails.logger.debug "token - " + token.to_s + #Rails.logger.debug "token - " + token.to_s @user = Employee.authenticate_by_token(token) if @user diff --git a/app/models/license.rb b/app/models/license.rb index d025e349..ddb9a8c0 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -33,7 +33,7 @@ class License ##Get redis connection from connection pool redis = Redis.new cache_license = redis.get(cache_key) - + Rails.logger.info "Cache key - " + cache_key.to_s if cache_license.nil? ##change the d/e key diff --git a/config/secrets.yml b/config/secrets.yml index a0220639..286c1ade 100755 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -12,8 +12,8 @@ development: secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61 - sx_provision_url: connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api - server_mode: application + sx_provision_url: 192.168.1.125:3002/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api + server_mode: cloud cipher_type: AES-256-CBC sx_key: Wh@t1$C2L diff --git a/config/shops.json b/config/shops.json index 268c73f0..dc0e3b46 100644 --- a/config/shops.json +++ b/config/shops.json @@ -1,3 +1,18 @@ { - "data": [] + "data": [ + { + "lookup": "chromis-1.zsai.ws", + "value": { + "key": "877eY5iPvpVzaYnIkc2FgIy0U85FtqpTpQGqoM/RCG0=\n", + "iv": "qSVQaKzOm3TYmRP3DhHdig==\n" + } + }, + { + "lookup": "gw2a-13.zsai.dev", + "value": { + "key": "R0uRkGlvCD5DGaPV4SkhGlwaMR0ohYBBmNna+tpRXMc=\n", + "iv": "AP5iuLM36oJmnvLsWCo9+Q==\n" + } + } + ] }