dashboard hourly sale and license code clean
This commit is contained in:
@@ -18,39 +18,21 @@ class License
|
||||
if (server != "")
|
||||
self.class.base_uri server
|
||||
end
|
||||
|
||||
# @secret = ENV["aes_key"]
|
||||
# @params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
|
||||
end
|
||||
|
||||
# For Cloud
|
||||
def detail_with_local_cache(lookup)
|
||||
|
||||
aes = MyAesCrypt.new
|
||||
aes_key, aes_iv = aes.export_to_file(lookup)
|
||||
# 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
|
||||
cache_key = "#{lookup}:license:#{aes_key}:hostname"
|
||||
|
||||
# No Needs for current
|
||||
# @secret = key
|
||||
##Check from local redis - if available load local otherwise get from remote
|
||||
cache_key = "#{lookup}:license:#{aes_key}:hostname"
|
||||
|
||||
cache_license = nil
|
||||
|
||||
##Get redis connection from connection pool
|
||||
redis = Redis.new
|
||||
cache_license = redis.get(cache_key)
|
||||
# Redis.current do |conn|
|
||||
# cache_license = conn.get(cache_key)
|
||||
# end
|
||||
cache_license = redis.get(cache_key)
|
||||
|
||||
Rails.logger.info "Cache key - " + cache_key.to_s
|
||||
if cache_license.nil?
|
||||
@@ -85,7 +67,7 @@ class License
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# For Local System
|
||||
def detail_with_local_file()
|
||||
has_license = true # verify_license()
|
||||
|
||||
@@ -117,8 +99,7 @@ class License
|
||||
end
|
||||
|
||||
def verify_license
|
||||
api_token = read_license_no_decrypt("api_token")
|
||||
puts api_token
|
||||
api_token = read_license_no_decrypt("api_token")
|
||||
@params = { query: {lookup_type: "application", api_token: api_token} }
|
||||
response = self.class.get("/verify", @params)
|
||||
@varified = response.parsed_response
|
||||
|
||||
Reference in New Issue
Block a user