Support ssl connection on mysql
This commit is contained in:
parent
ee736b1ab7
commit
9c25d1024a
|
@ -39,7 +39,7 @@
|
||||||
{if_var_true, stun, {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.31"}}}},
|
{if_var_true, stun, {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.31"}}}},
|
||||||
{if_var_true, sip, {esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.32"}}}},
|
{if_var_true, sip, {esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.32"}}}},
|
||||||
{if_var_true, mysql, {p1_mysql, ".*", {git, "https://github.com/processone/p1_mysql",
|
{if_var_true, mysql, {p1_mysql, ".*", {git, "https://github.com/processone/p1_mysql",
|
||||||
{tag, "1.0.13"}}}},
|
"a34873415d3e66de98f5abfe89406fade9915964"}}},
|
||||||
{if_var_true, pgsql, {p1_pgsql, ".*", {git, "https://github.com/processone/p1_pgsql",
|
{if_var_true, pgsql, {p1_pgsql, ".*", {git, "https://github.com/processone/p1_pgsql",
|
||||||
{tag, "1.1.9"}}}},
|
{tag, "1.1.9"}}}},
|
||||||
{if_var_true, sqlite, {sqlite3, ".*", {git, "https://github.com/processone/erlang-sqlite3",
|
{if_var_true, sqlite, {sqlite3, ".*", {git, "https://github.com/processone/erlang-sqlite3",
|
||||||
|
|
|
@ -1001,12 +1001,18 @@ pgsql_execute_to_odbc(_) -> {updated, undefined}.
|
||||||
|
|
||||||
%% part of init/1
|
%% part of init/1
|
||||||
%% Open a database connection to MySQL
|
%% Open a database connection to MySQL
|
||||||
mysql_connect(Server, Port, DB, Username, Password, ConnectTimeout, _, _) ->
|
mysql_connect(Server, Port, DB, Username, Password, ConnectTimeout, Transport, _) ->
|
||||||
|
SSLOpts = case Transport of
|
||||||
|
ssl ->
|
||||||
|
[ssl_required];
|
||||||
|
_ ->
|
||||||
|
[]
|
||||||
|
end,
|
||||||
case p1_mysql_conn:start(binary_to_list(Server), Port,
|
case p1_mysql_conn:start(binary_to_list(Server), Port,
|
||||||
binary_to_list(Username),
|
binary_to_list(Username),
|
||||||
binary_to_list(Password),
|
binary_to_list(Password),
|
||||||
binary_to_list(DB),
|
binary_to_list(DB),
|
||||||
ConnectTimeout, fun log/3)
|
ConnectTimeout, fun log/3, SSLOpts)
|
||||||
of
|
of
|
||||||
{ok, Ref} ->
|
{ok, Ref} ->
|
||||||
p1_mysql_conn:fetch(
|
p1_mysql_conn:fetch(
|
||||||
|
@ -1112,6 +1118,8 @@ warn_if_ssl_unsupported(tcp, _) ->
|
||||||
ok;
|
ok;
|
||||||
warn_if_ssl_unsupported(ssl, pgsql) ->
|
warn_if_ssl_unsupported(ssl, pgsql) ->
|
||||||
ok;
|
ok;
|
||||||
|
warn_if_ssl_unsupported(ssl, mysql) ->
|
||||||
|
ok;
|
||||||
warn_if_ssl_unsupported(ssl, Type) ->
|
warn_if_ssl_unsupported(ssl, Type) ->
|
||||||
?WARNING_MSG("SSL connection is not supported for ~ts", [Type]).
|
?WARNING_MSG("SSL connection is not supported for ~ts", [Type]).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue