fix: placeholder & topic schema no default

This commit is contained in:
DDDHuang 2021-08-25 11:29:13 +08:00 committed by turtleDeng
parent b13ae50bed
commit bafe5bae1c
2 changed files with 2 additions and 2 deletions

View File

@ -61,7 +61,7 @@ to_topic([Binary | PTs], C, Co, Res) when is_binary(Binary) ->
to_topic([clientid | PTs], C = #{clientid := ClientID}, Co, Res) -> to_topic([clientid | PTs], C = #{clientid := ClientID}, Co, Res) ->
to_topic(PTs, C, Co, [ClientID | Res]); to_topic(PTs, C, Co, [ClientID | Res]);
to_topic([username | PTs], C = #{username := undefined}, Co, Res) -> to_topic([username | PTs], C = #{username := undefined}, Co, Res) ->
to_topic(PTs, C, Co, [<<"undefined">> | Res]); to_topic(PTs, C, Co, [<<"${username}">> | Res]);
to_topic([username | PTs], C = #{username := Username}, Co, Res) -> to_topic([username | PTs], C = #{username := Username}, Co, Res) ->
to_topic(PTs, C, Co, [Username | Res]); to_topic(PTs, C, Co, [Username | Res]);
to_topic([host | PTs], C, Co = #{peername := {Host, _}}, Res) -> to_topic([host | PTs], C, Co = #{peername := {Host, _}}, Res) ->

View File

@ -29,6 +29,6 @@ fields("auto_subscribe") ->
[ {topics, hoconsc:array(hoconsc:ref(?MODULE, "topic"))}]; [ {topics, hoconsc:array(hoconsc:ref(?MODULE, "topic"))}];
fields("topic") -> fields("topic") ->
[ {topic, emqx_schema:t(binary(), undefined, <<"">>)} [ {topic, emqx_schema:t(binary())}
, {qos, emqx_schema:t(integer(), undefined, 0)} , {qos, emqx_schema:t(integer(), undefined, 0)}
]. ].