|
|
@@ -62,6 +62,7 @@
|
|
|
-type url() :: binary().
|
|
|
-type json_binary() :: binary().
|
|
|
-type template() :: binary().
|
|
|
+-type template_str() :: string().
|
|
|
|
|
|
-typerefl_from_string({duration/0, emqx_schema, to_duration}).
|
|
|
-typerefl_from_string({duration_s/0, emqx_schema, to_duration_s}).
|
|
|
@@ -80,6 +81,7 @@
|
|
|
-typerefl_from_string({url/0, emqx_schema, to_url}).
|
|
|
-typerefl_from_string({json_binary/0, emqx_schema, to_json_binary}).
|
|
|
-typerefl_from_string({template/0, emqx_schema, to_template}).
|
|
|
+-typerefl_from_string({template_str/0, emqx_schema, to_template_str}).
|
|
|
|
|
|
-type parsed_server() :: #{
|
|
|
hostname := string(),
|
|
|
@@ -123,7 +125,8 @@
|
|
|
to_comma_separated_atoms/1,
|
|
|
to_url/1,
|
|
|
to_json_binary/1,
|
|
|
- to_template/1
|
|
|
+ to_template/1,
|
|
|
+ to_template_str/1
|
|
|
]).
|
|
|
|
|
|
-export([
|
|
|
@@ -164,7 +167,8 @@
|
|
|
url/0,
|
|
|
json_binary/0,
|
|
|
port_number/0,
|
|
|
- template/0
|
|
|
+ template/0,
|
|
|
+ template_str/0
|
|
|
]).
|
|
|
|
|
|
-export([namespace/0, roots/0, roots/1, fields/1, desc/1, tags/0]).
|
|
|
@@ -2601,6 +2605,9 @@ to_json_binary(Str) ->
|
|
|
to_template(Str) ->
|
|
|
{ok, iolist_to_binary(Str)}.
|
|
|
|
|
|
+to_template_str(Str) ->
|
|
|
+ {ok, unicode:characters_to_list(Str, utf8)}.
|
|
|
+
|
|
|
%% @doc support the following format:
|
|
|
%% - 127.0.0.1:1883
|
|
|
%% - ::1:1883
|