From 485a719342caae6338531da8a8a5af500a1d863a Mon Sep 17 00:00:00 2001 From: Thein Lin Kyaw Date: Thu, 13 Feb 2020 15:19:20 +0630 Subject: [PATCH] fix check license subdomain --- app/models/license.rb | 9 ++------- config/initializers/action_controller.rb | 3 ++- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/models/license.rb b/app/models/license.rb index 28a71a25..f22357d2 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -195,16 +195,11 @@ class License end end - def self.check_license_subdomain(lookup) + def check_license_subdomain(lookup) aes = MyAesCrypt.new aes_key, aes_iv = aes.export_key(lookup) - server_mode = ENV["SERVER_MODE"] - unless ENV["SERVER_MODE"] == "cloud" - server_mode = "application" - end - - params = { query: { lookup_type: server_mode, lookup: lookup, iv_key: aes_iv} } + params = { query: { lookup_type: self.server_mode, lookup: lookup, iv_key: aes_iv} } response = self.class.get("/subdomain", params) response.parsed_response["status"] end diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 74cc67eb..8931f599 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -63,7 +63,8 @@ class ActionController::Base end def check_subdomain(lookup) - License.check_license_subdomain(lookup) + license = License.new(ENV["SX_PROVISION_URL"], lookup) + license.check_license_subdomain(lookup) end def check_license(lookup)