49 lines
1.3 KiB
Ruby
Executable File
49 lines
1.3 KiB
Ruby
Executable File
class InstallController < BaseController
|
|
def index
|
|
end
|
|
|
|
def activate
|
|
restaurant = params[:restaurant_name]
|
|
license_key = params[:license_key]
|
|
admin_user = params[:admin_user]
|
|
admin_password = params[:admin_password]
|
|
db_user = params[:db_user]
|
|
db_password = params[:db_password]
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def lookup_domain
|
|
if request.subdomain.present? && request.subdomain != "www"
|
|
@license = current_license(ENV["SX_PROVISION_URL"], request.subdomain.downcase)
|
|
if (!@license.nil?)
|
|
# logger.info "Location - " + @license.name
|
|
ActiveRecord::Base.establish_connection(website_connection(@license))
|
|
# logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema
|
|
else
|
|
# reconnect_default_db
|
|
logger.info 'License is nil'
|
|
# redirect_to root_url(:host => request.domain) + "store_error"
|
|
render :json => [{ status: false, message: 'Invalid Access!'}]
|
|
end
|
|
end
|
|
end
|
|
|
|
def current_license(url, key)
|
|
@license = License.new(url, key)
|
|
|
|
##creating md5 hash
|
|
md5_hostname = Digest::MD5.new
|
|
md5key = md5_hostname.update(request.host)
|
|
if (@license.detail_with_local_cache(key, md5key.to_s) == true)
|
|
#if (@license.detail == true)
|
|
|
|
return @license
|
|
else
|
|
return nil
|
|
end
|
|
end
|
|
end
|