license updating
This commit is contained in:
@@ -24,17 +24,17 @@ class License
|
|||||||
end
|
end
|
||||||
|
|
||||||
def detail_with_local_cache(lookup)
|
def detail_with_local_cache(lookup)
|
||||||
subdomain = request.subdomain.downcase
|
|
||||||
flag = ENV["AES_IV"]
|
# flag = ENV["AES_IV"]
|
||||||
# Check Exists IV
|
# # Check Exists IV
|
||||||
if flag == "<%= ENV['AES_IV'] %>"
|
# if flag == "<%= ENV['AES_IV'] %>"
|
||||||
# Export for Key
|
# # Export for Key
|
||||||
aes = MyAesCrypt.new
|
# aes = MyAesCrypt.new
|
||||||
aes_key, aes_iv = aes.export_key(lookup)
|
# aes_key, aes_iv = aes.export_key(lookup)
|
||||||
else
|
# else
|
||||||
aes_key = ENV["AES_KEY"]
|
# aes_key = ENV["AES_KEY"]
|
||||||
aes_iv = ENV["AES_IV"]
|
# aes_iv = ENV["AES_IV"]
|
||||||
end
|
# 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"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
require 'openssl'
|
require 'openssl'
|
||||||
require 'base64'
|
require 'base64'
|
||||||
|
require 'json'
|
||||||
|
|
||||||
class MyAesCrypt
|
class MyAesCrypt
|
||||||
@cipher = ""
|
@cipher = ""
|
||||||
@@ -26,6 +27,21 @@ class MyAesCrypt
|
|||||||
return cipher_key, cipher_iv
|
return cipher_key, cipher_iv
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def export_to_file(passphrase)
|
||||||
|
file_path = "config/shops.json"
|
||||||
|
aes_key, aes_iv = export_key(passphrase)
|
||||||
|
tmpHash = {
|
||||||
|
"lookup" => passphrase,
|
||||||
|
"key" => aes_key,
|
||||||
|
"iv" => aes_iv
|
||||||
|
}
|
||||||
|
|
||||||
|
File.open(file_path, "w") { |io|
|
||||||
|
io.write(tmpHash.to_json)
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def encrypt(data)
|
def encrypt(data)
|
||||||
cipher.encrypt
|
cipher.encrypt
|
||||||
|
|||||||
Reference in New Issue
Block a user