license sym config
This commit is contained in:
@@ -23,14 +23,6 @@ class License
|
|||||||
# @params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
|
# @params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } }
|
||||||
end
|
end
|
||||||
|
|
||||||
# def shop_code
|
|
||||||
# if ( self.subdomain.length > 3)
|
|
||||||
# return self.subdomain[0,3].upcase
|
|
||||||
# else
|
|
||||||
# return self.subdomain.upcase
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
def detail_with_local_cache(lookup, key, iv)
|
def detail_with_local_cache(lookup, key, iv)
|
||||||
##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"
|
||||||
@@ -89,60 +81,6 @@ class License
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# if cache_license.nil?
|
|
||||||
# ##change the d/e key
|
|
||||||
# @params = { query: { lookup_type: self.server_mode, lookup: lookup, encrypted_key: key, iv_key: iv} }
|
|
||||||
|
|
||||||
# response = self.class.get("/request_license", @params)
|
|
||||||
# @license = response.parsed_response
|
|
||||||
|
|
||||||
# if (@license["status"] == true)
|
|
||||||
|
|
||||||
# assign()
|
|
||||||
|
|
||||||
# Rails.logger.info "License - " + response.parsed_response.to_s
|
|
||||||
|
|
||||||
# Redis.current do |conn|
|
|
||||||
# ##Remote - store the remote response in local redis cache
|
|
||||||
# conn.set(cache_key, Marshal.dump(@license))
|
|
||||||
# ##ADD to List to remove later
|
|
||||||
# conn.sadd("License:cache:keys", cache_key)
|
|
||||||
# end
|
|
||||||
|
|
||||||
# return true
|
|
||||||
# end
|
|
||||||
|
|
||||||
# Rails.logger.info 'API License'
|
|
||||||
|
|
||||||
# else
|
|
||||||
# @license = Marshal.load(cache_license) if cache_license
|
|
||||||
|
|
||||||
# Rails.logger.info 'Cache License'
|
|
||||||
|
|
||||||
# if (@license["status"] == true)
|
|
||||||
# assign()
|
|
||||||
# return true
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# return false
|
|
||||||
#end
|
|
||||||
|
|
||||||
# def detail
|
|
||||||
# response = self.class.get("/subdomain", @options)
|
|
||||||
# @license = response.parsed_response
|
|
||||||
|
|
||||||
# Rails.logger.debug "License - " + response.parsed_response.to_s
|
|
||||||
|
|
||||||
|
|
||||||
# if (@license["status"] == true)
|
|
||||||
# assign()
|
|
||||||
|
|
||||||
# return true
|
|
||||||
# end
|
|
||||||
|
|
||||||
# return false
|
|
||||||
# end
|
|
||||||
|
|
||||||
# License Activation
|
# License Activation
|
||||||
def license_activate (key, iv, license_key, db_host, db_schema, db_user, db_password)
|
def license_activate (key, iv, license_key, db_host, db_schema, db_user, db_password)
|
||||||
@params = { query: { lookup_type: self.server_mode, encrypted_key: key, iv_key: iv, license_key: license_key } }
|
@params = { query: { lookup_type: self.server_mode, encrypted_key: key, iv_key: iv, license_key: license_key } }
|
||||||
@@ -154,8 +92,11 @@ class License
|
|||||||
if (@activate["status"])
|
if (@activate["status"])
|
||||||
response = create_license_file(@activate)
|
response = create_license_file(@activate)
|
||||||
if(response["status"])
|
if(response["status"])
|
||||||
sym_path = "/home/yan/symmetric/engines"
|
sym_path = "/home/yan/symmetric/"
|
||||||
response = create_symmetric_config(sym_path, db_host, db_schema, db_user, db_password)
|
response = create_symmetric_config(sym_path, db_host, db_schema, db_user, db_password)
|
||||||
|
if(response["status"])
|
||||||
|
run_symmetric(sym_path)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
response = { "status": false, "message": "Activation Failed! Please contact code2lab call center!"}
|
response = { "status": false, "message": "Activation Failed! Please contact code2lab call center!"}
|
||||||
@@ -180,35 +121,6 @@ class License
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
# def check_remote_license(license_key)
|
|
||||||
# # @options = { query: {device: "cloud", key: license_key, skey: @secret, token: Rails.application.secrets.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
|
|
||||||
|
|
||||||
# Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
|
||||||
# if (@license["status"])
|
|
||||||
# assign()
|
|
||||||
# end
|
|
||||||
# return @license["status"]
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def verify_by_api_token(api_token)
|
|
||||||
# @options = { query: {device: "SX", api_token: api_token, skey: @secret, token: SECRETS_CONFIG['provision_key']} }
|
|
||||||
# response = self.class.get("/verify_token", @options)
|
|
||||||
|
|
||||||
# @license = response.parsed_response
|
|
||||||
|
|
||||||
# Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
|
||||||
# if (@license["status"])
|
|
||||||
# assign()
|
|
||||||
# end
|
|
||||||
|
|
||||||
# return @license["status"]
|
|
||||||
# end
|
|
||||||
#Load License is remove from the cloud license because - this license is must be validated against subdmain instead of license.data from file.
|
|
||||||
|
|
||||||
# Check License expired date from PROVISION SERVER
|
# Check License expired date from PROVISION SERVER
|
||||||
def check_expired(renewal_date)
|
def check_expired(renewal_date)
|
||||||
if (renewal_date < Date.today)
|
if (renewal_date < Date.today)
|
||||||
@@ -276,7 +188,7 @@ class License
|
|||||||
if File.directory? (sym_location)
|
if File.directory? (sym_location)
|
||||||
begin
|
begin
|
||||||
# sx properties create
|
# sx properties create
|
||||||
f = File.open(sym_location + "/sx.properties", "w")
|
f = File.open(sym_location + "engines/sx.properties", "w")
|
||||||
f.write("engine.name=sx\n")
|
f.write("engine.name=sx\n")
|
||||||
f.write("db.driver=com.mysql.jdbc.Driver\n")
|
f.write("db.driver=com.mysql.jdbc.Driver\n")
|
||||||
f.write("db.url=jdbc:mysql://#{db_host}/#{db_schema}?tinyInt1isBit=false\n")
|
f.write("db.url=jdbc:mysql://#{db_host}/#{db_schema}?tinyInt1isBit=false\n")
|
||||||
@@ -324,6 +236,11 @@ class License
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Run Symmetric
|
||||||
|
def run_symmetric(sym_path)
|
||||||
|
check_sym_proc = system(sym_path)
|
||||||
|
end
|
||||||
|
|
||||||
# Delete License File
|
# Delete License File
|
||||||
def delete_license_file
|
def delete_license_file
|
||||||
File.delete("config/license.yml") if File.exist?("config/license.yml")
|
File.delete("config/license.yml") if File.exist?("config/license.yml")
|
||||||
|
|||||||
Reference in New Issue
Block a user