diff --git a/src/sqerl_client.erl b/src/sqerl_client.erl index c0a6eaf..083da0b 100644 --- a/src/sqerl_client.erl +++ b/src/sqerl_client.erl @@ -131,6 +131,7 @@ init(CallbackMod) -> {user, envy:get(sqerl, db_user, string)}, {pass, envy:get(sqerl, db_pass, string)}, {db, envy:get(sqerl, db_name, string)}, + {opts, envy:get(sqerl, db_opts, [], list)}, {timeout, envy:get(sqerl,db_timeout, 5000, pos_integer)}, {idle_check, IdleCheck}, {prepared_statements, Statements}, diff --git a/src/sqerl_pgsql_client.erl b/src/sqerl_pgsql_client.erl index 4251eb6..3755e11 100644 --- a/src/sqerl_pgsql_client.erl +++ b/src/sqerl_pgsql_client.erl @@ -171,13 +171,14 @@ init(Config) -> {timeout, Timeout} = lists:keyfind(timeout, 1, Config), {db, Db} = lists:keyfind(db, 1, Config), {prepared_statements, Statements} = lists:keyfind(prepared_statements, 1, Config), - Opts = [{database, Db}, {port, Port}, {timeout, Timeout}], + {opts, Opts} = lists:keyfind(opts, 1, Config), + Opts2 = lists:flatten([Opts | [{database, Db}, {port, Port}, {timeout, Timeout}]]), CTrans = case lists:keyfind(column_transforms, 1, Config) of {column_transforms, CT} -> CT; false -> undefined end, - case pgsql:connect(Host, User, Pass, Opts) of + case pgsql:connect(Host, User, Pass, Opts2) of {error, timeout} -> {stop, timeout}; {ok, Connection} ->