license cloud done

This commit is contained in:
Yan
2017-11-16 20:46:03 +06:30
parent 178b3484be
commit 29322d952e
5 changed files with 64 additions and 30 deletions

View File

@@ -22,8 +22,8 @@ class ApplicationController < ActionController::Base
{ locale: I18n.locale }
end
def lookup_domain
if request.subdomain.present? && request.subdomain != "www"
def lookup_domain
if request.subdomain.present? && request.subdomain != "www"
@license = cache_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase) # request.subdomain.downcase
if (!@license.nil?)
# logger.info "Location - " + @license.name
@@ -54,10 +54,17 @@ class ApplicationController < ActionController::Base
end
def cache_license(url, lookup)
flag = ENV["AES_IV"]
@license = License.new(url, lookup)
# Export for Key
aes = MyAesCrypt.new
aes_key, aes_iv = aes.export_key(lookup)
if flag == "<%= ENV['AES_IV'] %>"
aes = MyAesCrypt.new
aes_key, aes_iv = aes.export_key(lookup)
else
aes_key = ENV["AES_KEY"]
aes_iv = ENV["AES_IV"]
end
if (@license.detail_with_local_cache(lookup, aes_key, aes_iv) == true)
return @license

View File

@@ -16,7 +16,7 @@ class InstallController < BaseController
# Export for Key
aes = MyAesCrypt.new
aes_key, aes_iv = aes.export_key(lookup)
aes_key, aes_iv = aes.export_key(license_key)
@license = License.new(ENV["SX_PROVISION_URL"])
response = @license.license_activate(aes_key, aes_iv, license_key, db_host, db_schema, db_user, db_password)