Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes
This commit is contained in:
@@ -55,21 +55,10 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def cache_license(url, lookup)
|
def cache_license(url, lookup)
|
||||||
flag = ENV["AES_IV"]
|
@license = License.new(url, lookup)
|
||||||
@license = License.new(url, lookup)
|
|
||||||
|
|
||||||
# Check Exists IV
|
if (@license.detail_with_local_cache(lookup) == true)
|
||||||
if flag == "<%= ENV['AES_IV'] %>"
|
|
||||||
# Export for Key
|
|
||||||
aes = MyAesCrypt.new
|
|
||||||
aes_key, aes_iv = aes.export_key(lookup)
|
|
||||||
else
|
|
||||||
aes_key = ENV["AES_KEY"]
|
|
||||||
aes_iv = ENV["AES_IV"]
|
|
||||||
end
|
|
||||||
|
|
||||||
if (@license.detail_with_local_cache(lookup, aes_key, aes_iv) == true)
|
|
||||||
return @license
|
return @license
|
||||||
else
|
else
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -23,7 +23,18 @@ class License
|
|||||||
# @params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
|
# @params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
|
||||||
end
|
end
|
||||||
|
|
||||||
def detail_with_local_cache(lookup, key, iv)
|
def detail_with_local_cache(lookup)
|
||||||
|
subdomain = request.subdomain.downcase
|
||||||
|
flag = ENV["AES_IV"]
|
||||||
|
# Check Exists IV
|
||||||
|
if flag == "<%= ENV['AES_IV'] %>"
|
||||||
|
# Export for Key
|
||||||
|
aes = MyAesCrypt.new
|
||||||
|
aes_key, aes_iv = aes.export_key(lookup)
|
||||||
|
else
|
||||||
|
aes_key = ENV["AES_KEY"]
|
||||||
|
aes_iv = ENV["AES_IV"]
|
||||||
|
end
|
||||||
##Check from local redis - if available load local otherwise get from remote
|
##Check from local redis - if available load local otherwise get from remote
|
||||||
cache_key = "#{lookup}:license:#{key}:hostname"
|
cache_key = "#{lookup}:license:#{key}:hostname"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user