Skip to content

Commit

Permalink
fix(bridge): ensure the username of pgsql must exists
Browse files Browse the repository at this point in the history
  • Loading branch information
lafirest committed Jul 7, 2023
1 parent 055a1e8 commit 8cee751
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/emqx_connector/src/emqx_connector_pgsql.erl
Expand Up @@ -69,14 +69,30 @@ roots() ->

fields(config) ->
[{server, server()}] ++
emqx_connector_schema_lib:relational_db_fields() ++
adjust_fields(emqx_connector_schema_lib:relational_db_fields()) ++
emqx_connector_schema_lib:ssl_fields() ++
emqx_connector_schema_lib:prepare_statement_fields().

server() ->
Meta = #{desc => ?DESC("server")},
emqx_schema:servers_sc(Meta, ?PGSQL_HOST_OPTIONS).

adjust_fields(Fields) ->
lists:map(
fun
({username, OrigUsernameFn}) ->
{username, fun
(required) ->
true;
(Any) ->
OrigUsernameFn(Any)
end};
(Field) ->
Field
end,
Fields
).

%% ===================================================================
callback_mode() -> always_sync.

Expand Down

0 comments on commit 8cee751

Please sign in to comment.