mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Added options to specify an SSL connection for MySQL. Define the following attributes in the connection config (config/database.yml in Rails) to use it: sslkey, sslcert, sslca, sslcapath, sslcipher. To use SSL with no client certs, just set :sslca = /dev/null. http://dev.mysql.com/doc/mysql/en/secure-connections.html #604 [daniel@nightrunner.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@720 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
101968f367
commit
ba309a3e38
2 changed files with 8 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Added options to specify an SSL connection for MySQL. Define the following attributes in the connection config (config/database.yml in Rails) to use it: sslkey, sslcert, sslca, sslcapath, sslcipher. To use SSL with no client certs, just set :sslca = '/dev/null'. http://dev.mysql.com/doc/mysql/en/secure-connections.html #604 [daniel@nightrunner.com]
|
||||||
|
|
||||||
* Added automatic dropping/creating of test tables for running the unit tests on all databases #587 [adelle@bullet.net.au]
|
* Added automatic dropping/creating of test tables for running the unit tests on all databases #587 [adelle@bullet.net.au]
|
||||||
|
|
||||||
* Fixed that find_by_* would fail when column names had numbers #670 [demetrius]
|
* Fixed that find_by_* would fail when column names had numbers #670 [demetrius]
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'parsedate'
|
||||||
|
|
||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
class Base
|
class Base
|
||||||
# Establishes a connection to the database that's used by all Active Record objects
|
# Establishes a connection to the database that's used by all Active Record objects.
|
||||||
def self.mysql_connection(config) # :nodoc:
|
def self.mysql_connection(config) # :nodoc:
|
||||||
unless self.class.const_defined?(:Mysql)
|
unless self.class.const_defined?(:Mysql)
|
||||||
begin
|
begin
|
||||||
|
@ -19,7 +19,9 @@ module ActiveRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
symbolize_strings_in_hash(config)
|
symbolize_strings_in_hash(config)
|
||||||
|
|
||||||
host = config[:host]
|
host = config[:host]
|
||||||
port = config[:port]
|
port = config[:port]
|
||||||
socket = config[:socket]
|
socket = config[:socket]
|
||||||
|
@ -32,9 +34,9 @@ module ActiveRecord
|
||||||
raise ArgumentError, "No database specified. Missing argument: database."
|
raise ArgumentError, "No database specified. Missing argument: database."
|
||||||
end
|
end
|
||||||
|
|
||||||
ConnectionAdapters::MysqlAdapter.new(
|
mysql = Mysql.init
|
||||||
Mysql::real_connect(host, username, password, database, port, socket), logger
|
mysql.ssl_set(config[:sslkey], config[:sslcert], config[:sslca], config[:sslcapath], config[:sslcipher]) if config[:sslkey]
|
||||||
)
|
ConnectionAdapters::MysqlAdapter.new(mysql.real_connect(host, username, password, database, port, socket), logger)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue