license cloud finished
This commit is contained in:
@@ -61,7 +61,7 @@ class License
|
|||||||
@license = response.parsed_response
|
@license = response.parsed_response
|
||||||
|
|
||||||
if (@license["status"] == true)
|
if (@license["status"] == true)
|
||||||
assign()
|
assign(aes_key, aes_iv)
|
||||||
|
|
||||||
Rails.logger.info "License - " + response.parsed_response.to_s
|
Rails.logger.info "License - " + response.parsed_response.to_s
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ class License
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
@license = Marshal.load(cache_license)
|
@license = Marshal.load(cache_license)
|
||||||
assign()
|
assign(aes_key, aes_iv)
|
||||||
Rails.logger.info 'API License'
|
Rails.logger.info 'API License'
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -330,7 +330,7 @@ class License
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Assign db info for Cloud
|
# Assign db info for Cloud
|
||||||
def assign
|
def assign(aes_key, aes_iv)
|
||||||
# self.name = @license["name"]
|
# self.name = @license["name"]
|
||||||
# self.address_1 = @license["address_1"]
|
# self.address_1 = @license["address_1"]
|
||||||
# self.address_2 = @license["address_2"]
|
# self.address_2 = @license["address_2"]
|
||||||
@@ -354,8 +354,8 @@ class License
|
|||||||
# self.plan_active_connections = @license["plan_active_connections"].to_i
|
# self.plan_active_connections = @license["plan_active_connections"].to_i
|
||||||
# salt = @license["secret_key"]
|
# salt = @license["secret_key"]
|
||||||
|
|
||||||
key = Base64.decode64(ENV['AES_KEY'])
|
key = Base64.decode64(aes_key)
|
||||||
iv = Base64.decode64(ENV['AES_IV'])
|
iv = Base64.decode64(aes_iv)
|
||||||
|
|
||||||
if (@license["dbhost"] || @license["dbschema"] || @license["dbusername"] || @license["dbpassword"] )
|
if (@license["dbhost"] || @license["dbschema"] || @license["dbusername"] || @license["dbpassword"] )
|
||||||
host = Base64.decode64(@license["dbhost"])
|
host = Base64.decode64(@license["dbhost"])
|
||||||
|
|||||||
@@ -40,27 +40,20 @@ class MyAesCrypt
|
|||||||
}
|
}
|
||||||
|
|
||||||
shop_data = File.read(file_path)
|
shop_data = File.read(file_path)
|
||||||
if shop_data != ""
|
|
||||||
shop_json = JSON.parse(shop_data)
|
shop_json = JSON.parse(shop_data)
|
||||||
shop_json.each do |j|
|
shop_json["data"].each do |j|
|
||||||
byebug
|
if j["lookup"] == passphrase
|
||||||
if j == passphrase
|
return j["value"]["key"], j["value"]["iv"]
|
||||||
j.each do |k|
|
|
||||||
return k["key"], k["iv"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
shop_json << tmpHash
|
|
||||||
|
|
||||||
File.open(file_path, "w") { |io|
|
|
||||||
io.puts JSON.pretty_generate(shop_json)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
File.open(file_path, "w") { |io|
|
|
||||||
io.write(tmpHash.to_json)
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
shop_json["data"] << tmpHash
|
||||||
|
|
||||||
|
File.open(file_path, "w") { |io|
|
||||||
|
io.puts JSON.pretty_generate(shop_json)
|
||||||
|
}
|
||||||
|
|
||||||
return aes_key, aes_iv
|
return aes_key, aes_iv
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user