edit api cntr

This commit is contained in:
Yan
2018-04-20 20:27:08 +06:30
parent 0aa080573c
commit 835231bd61

View File

@@ -41,6 +41,21 @@ class Api::ApiController < ActionController::API
end
end
def website_connection(license)
default_connection.dup.update(:host => license.dbhost, :database => license.dbschema.to_s.downcase,
:username => license.dbusername, :password => license.dbpassword)
end
def reconnect_default_db
ActiveRecord::Base.establish_connection(Rails.env)
end
# Regular database.yml configuration hash
def default_connection
@default_config ||= ActiveRecord::Base.connection.instance_variable_get("@config").dup
end
def cache_license(url, lookup)
@license = License.new(url, lookup)