|
|
@@ -24,6 +24,8 @@
|
|
|
, fields/1
|
|
|
]).
|
|
|
|
|
|
+-import(emqx_schema, [sc/2]).
|
|
|
+
|
|
|
roots() -> ["psk_authentication"].
|
|
|
|
|
|
fields("psk_authentication") ->
|
|
|
@@ -42,35 +44,27 @@ to which is configurable by the <code>init_file</code> field.
|
|
|
}.
|
|
|
|
|
|
fields() ->
|
|
|
- [ {enable, fun enable/1}
|
|
|
- , {init_file, fun init_file/1}
|
|
|
- , {separator, fun separator/1}
|
|
|
- , {chunk_size, fun chunk_size/1}
|
|
|
+ [ {enable, sc(boolean(), #{default => false,
|
|
|
+ desc => <<"Whether to enable TLS PSK support">>
|
|
|
+ })}
|
|
|
+ , {init_file, sc(binary(),
|
|
|
+ #{required => false,
|
|
|
+ desc =>
|
|
|
+ <<"If init_file is specified, emqx will import PSKs from the file ",
|
|
|
+ "into the built-in database at startup for use by the runtime. ",
|
|
|
+ "The file has to be structured line-by-line, each line must be in ",
|
|
|
+ "the format of <code>PSKIdentity:SharedSecret</code>. For example: ",
|
|
|
+ "<code>mydevice1:c2VjcmV0</code>">>
|
|
|
+ })}
|
|
|
+ , {separator, sc(binary(),
|
|
|
+ #{default => <<":">>,
|
|
|
+ desc =>
|
|
|
+ <<"The separator between <code>PSKIdentity</code>"
|
|
|
+ " and <code>SharedSecret</code> in the psk file">>
|
|
|
+ })}
|
|
|
+ , {chunk_size, sc(integer(),
|
|
|
+ #{default => 50,
|
|
|
+ desc => <<"The size of each chunk used to import to"
|
|
|
+ " the built-in database from psk file">>
|
|
|
+ })}
|
|
|
].
|
|
|
-
|
|
|
-enable(type) -> boolean();
|
|
|
-enable(desc) -> <<"Whether to enable TLS PSK support">>;
|
|
|
-enable(default) -> false;
|
|
|
-enable(_) -> undefined.
|
|
|
-
|
|
|
-init_file(type) -> binary();
|
|
|
-init_file(desc) ->
|
|
|
- <<"If init_file is specified, emqx will import PSKs from the file ",
|
|
|
- "into the built-in database at startup for use by the runtime. ",
|
|
|
- "The file has to be structured line-by-line, each line must be in ",
|
|
|
- "the format of <code>PSKIdentity:SharedSecret</code>. For example: ",
|
|
|
- "<code>mydevice1:c2VjcmV0</code>">>;
|
|
|
-init_file(required) -> false;
|
|
|
-init_file(_) -> undefined.
|
|
|
-
|
|
|
-separator(type) -> binary();
|
|
|
-separator(desc) ->
|
|
|
- <<"The separator between <code>PSKIdentity</code> and <code>SharedSecret</code> in the psk file">>;
|
|
|
-separator(default) -> <<":">>;
|
|
|
-separator(_) -> undefined.
|
|
|
-
|
|
|
-chunk_size(type) -> integer();
|
|
|
-chunk_size(desc) ->
|
|
|
- <<"The size of each chunk used to import to the built-in database from psk file">>;
|
|
|
-chunk_size(default) -> 50;
|
|
|
-chunk_size(_) -> undefined.
|