Skip to content

Commit c328ac5

Browse files
p8cgunther
andcommitted
Use sslmode option instead of ssl_mode for MySQL command connections
In f36c261a44 support for the ssl-mode option was added for MySQL when using the dbconsole command and MySQLDatabaseTasks. However, the mysql2 gem uses `ssl_mode` instead of `sslmode`: https://github.com/brianmario/mysql2/blob/ba4d46551d132492b34205cdb8fa224c92765bef/lib/mysql2/client.rb#L51 As `ssl_mode` is what should be used in the database.yml configuration for MySQL we should use it as well for the dbconsole command and MySQLDatabaseTasks. Co-authored-by: Chris Gunther <[email protected]>
1 parent 0915257 commit c328ac5

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

activerecord/lib/active_record/tasks/mysql_database_tasks.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def prepare_command_options
9595
sslcapath: "--ssl-capath",
9696
sslcipher: "--ssl-cipher",
9797
sslkey: "--ssl-key",
98-
sslmode: "--ssl-mode"
98+
ssl_mode: "--ssl-mode"
9999
}.filter_map { |opt, arg| "#{arg}=#{configuration_hash[opt]}" if configuration_hash[opt] }
100100

101101
args

railties/lib/rails/commands/dbconsole/dbconsole_command.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def start
3131
sslcapath: "--ssl-capath",
3232
sslcipher: "--ssl-cipher",
3333
sslkey: "--ssl-key",
34-
sslmode: "--ssl-mode"
34+
ssl_mode: "--ssl-mode"
3535
}.filter_map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }
3636

3737
if config[:password] && @options[:include_password]

railties/test/commands/dbconsole_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def test_mysql_full
127127
sslcapath: "/path/to/cacerts",
128128
sslcipher: "DHE-RSA-AES256-SHA",
129129
sslkey: "/path/to/client-key.pem",
130-
sslmode: "VERIFY_IDENTITY"
130+
ssl_mode: "VERIFY_IDENTITY"
131131
)
132132
assert_not aborted
133133
assert_equal [

0 commit comments

Comments
 (0)