license
This commit is contained in:
@@ -19,7 +19,10 @@ class License
|
||||
self.class.base_uri server
|
||||
end
|
||||
|
||||
@secret = SecureRandom.hex(10)
|
||||
# generate key for license file encrypt
|
||||
AESCrypt.export_key()
|
||||
|
||||
@secret = ENV["aes_key"]
|
||||
@params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
|
||||
end
|
||||
|
||||
@@ -31,6 +34,10 @@ class License
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_license_file
|
||||
return File.exist?("config/license.yml")
|
||||
end
|
||||
|
||||
def detail_with_local_cache(lookup, key)
|
||||
##Check from local redis - if available load local otherwise get from remote
|
||||
cache_key = "store:license:#{key}:hostname"
|
||||
@@ -50,7 +57,7 @@ class License
|
||||
if cache_license.nil?
|
||||
##change the d/e key
|
||||
# @options = { query: {device: "SXlite", lookup: lookup, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
@params = { query: { device: "SXlite", token: SECRETS_CONFIG['license_key']} }
|
||||
@params = { query: { lookup_type: "cloud", lookup: "subdomain", token: SECRETS_CONFIG['license_key']} }
|
||||
|
||||
response = self.class.get("/request_license", @params)
|
||||
@license = response.parsed_response
|
||||
@@ -106,7 +113,7 @@ class License
|
||||
|
||||
def check_remote_license(license_key)
|
||||
# @options = { query: {device: "cloud", key: license_key, skey: @secret, token: Rails.application.secrets.provision_key} }
|
||||
@options = { query: {device: "SX", key: license_key, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
@options = { query: {lookup_type: "application", encrypted_key: @secret, token: SECRETS_CONFIG['provision_key']} }
|
||||
response = self.class.get("/license", @options)
|
||||
|
||||
@license = response.parsed_response
|
||||
|
||||
Reference in New Issue
Block a user