Просмотр исходного кода

fix: placeholder & topic schema no default

DDDHuang 4 лет назад
Родитель
Сommit
bafe5bae1c

+ 1 - 1
apps/emqx_auto_subscribe/src/emqx_auto_subscribe_placeholder.erl

@@ -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(PTs, C, Co, [ClientID | 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(PTs, C, Co, [Username | Res]);
 to_topic([host | PTs], C, Co = #{peername := {Host, _}}, Res) ->

+ 1 - 1
apps/emqx_auto_subscribe/src/emqx_auto_subscribe_schema.erl

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