chore: fix typo
This commit is contained in:
parent
273dedf7a6
commit
47f826f99a
|
@ -3018,7 +3018,7 @@ non_empty_string(_) -> {error, invalid_string}.
|
||||||
%% hosts can be successfully parsed.
|
%% hosts can be successfully parsed.
|
||||||
%% 3. parsing: Done at runtime in each module which uses this config
|
%% 3. parsing: Done at runtime in each module which uses this config
|
||||||
servers_sc(Meta0, ParseOpts) ->
|
servers_sc(Meta0, ParseOpts) ->
|
||||||
%% if this filed has a default value
|
%% if this field has a default value
|
||||||
%% then it is not NOT required
|
%% then it is not NOT required
|
||||||
%% NOTE: maps:is_key is not the solution because #{default => undefined} is legit
|
%% NOTE: maps:is_key is not the solution because #{default => undefined} is legit
|
||||||
HasDefault = (maps:get(default, Meta0, undefined) =/= undefined),
|
HasDefault = (maps:get(default, Meta0, undefined) =/= undefined),
|
||||||
|
@ -3079,7 +3079,7 @@ servers_validator(Opts, Required) ->
|
||||||
%% we should remove field from config if it's empty
|
%% we should remove field from config if it's empty
|
||||||
throw("cannot_be_empty");
|
throw("cannot_be_empty");
|
||||||
"undefined" when Required ->
|
"undefined" when Required ->
|
||||||
%% when the filed is not set in config file
|
%% when the field is not set in config file
|
||||||
%% NOTE: assuming nobody is going to name their server "undefined"
|
%% NOTE: assuming nobody is going to name their server "undefined"
|
||||||
throw("cannot_be_empty");
|
throw("cannot_be_empty");
|
||||||
"undefined" ->
|
"undefined" ->
|
||||||
|
|
|
@ -181,7 +181,7 @@ t_create_with_config_values_wont_work(_Config) ->
|
||||||
InvalidConfigs
|
InvalidConfigs
|
||||||
).
|
).
|
||||||
|
|
||||||
%% creating without a require filed should return error
|
%% creating without a require field should return error
|
||||||
t_create_invalid_config(_Config) ->
|
t_create_invalid_config(_Config) ->
|
||||||
AuthzConfig = raw_redis_authz_config(),
|
AuthzConfig = raw_redis_authz_config(),
|
||||||
C = maps:without([<<"server">>], AuthzConfig),
|
C = maps:without([<<"server">>], AuthzConfig),
|
||||||
|
|
|
@ -95,33 +95,33 @@ namespace() -> "bridge_influxdb".
|
||||||
roots() -> [].
|
roots() -> [].
|
||||||
|
|
||||||
fields("post_api_v1") ->
|
fields("post_api_v1") ->
|
||||||
method_fileds(post, influxdb_api_v1);
|
method_fields(post, influxdb_api_v1);
|
||||||
fields("post_api_v2") ->
|
fields("post_api_v2") ->
|
||||||
method_fileds(post, influxdb_api_v2);
|
method_fields(post, influxdb_api_v2);
|
||||||
fields("put_api_v1") ->
|
fields("put_api_v1") ->
|
||||||
method_fileds(put, influxdb_api_v1);
|
method_fields(put, influxdb_api_v1);
|
||||||
fields("put_api_v2") ->
|
fields("put_api_v2") ->
|
||||||
method_fileds(put, influxdb_api_v2);
|
method_fields(put, influxdb_api_v2);
|
||||||
fields("get_api_v1") ->
|
fields("get_api_v1") ->
|
||||||
method_fileds(get, influxdb_api_v1);
|
method_fields(get, influxdb_api_v1);
|
||||||
fields("get_api_v2") ->
|
fields("get_api_v2") ->
|
||||||
method_fileds(get, influxdb_api_v2);
|
method_fieds(get, influxdb_api_v2);
|
||||||
fields(Type) when
|
fields(Type) when
|
||||||
Type == influxdb_api_v1 orelse Type == influxdb_api_v2
|
Type == influxdb_api_v1 orelse Type == influxdb_api_v2
|
||||||
->
|
->
|
||||||
influxdb_bridge_common_fields() ++
|
influxdb_bridge_common_fields() ++
|
||||||
connector_fields(Type).
|
connector_fields(Type).
|
||||||
|
|
||||||
method_fileds(post, ConnectorType) ->
|
method_fields(post, ConnectorType) ->
|
||||||
influxdb_bridge_common_fields() ++
|
influxdb_bridge_common_fields() ++
|
||||||
connector_fields(ConnectorType) ++
|
connector_fields(ConnectorType) ++
|
||||||
type_name_fields(ConnectorType);
|
type_name_fields(ConnectorType);
|
||||||
method_fileds(get, ConnectorType) ->
|
method_fields(get, ConnectorType) ->
|
||||||
influxdb_bridge_common_fields() ++
|
influxdb_bridge_common_fields() ++
|
||||||
connector_fields(ConnectorType) ++
|
connector_fields(ConnectorType) ++
|
||||||
type_name_fields(ConnectorType) ++
|
type_name_fields(ConnectorType) ++
|
||||||
emqx_bridge_schema:status_fields();
|
emqx_bridge_schema:status_fields();
|
||||||
method_fileds(put, ConnectorType) ->
|
method_fields(put, ConnectorType) ->
|
||||||
influxdb_bridge_common_fields() ++
|
influxdb_bridge_common_fields() ++
|
||||||
connector_fields(ConnectorType).
|
connector_fields(ConnectorType).
|
||||||
|
|
||||||
|
|
|
@ -1323,7 +1323,7 @@ roots(Module) ->
|
||||||
lists:map(fun({_BinName, Root}) -> Root end, hocon_schema:roots(Module)).
|
lists:map(fun({_BinName, Root}) -> Root end, hocon_schema:roots(Module)).
|
||||||
|
|
||||||
%% Like authentication schema, authorization schema is incomplete in emqx_schema
|
%% Like authentication schema, authorization schema is incomplete in emqx_schema
|
||||||
%% module, this function replaces the root filed "authorization" with a new schema
|
%% module, this function replaces the root field "authorization" with a new schema
|
||||||
emqx_schema_high_prio_roots() ->
|
emqx_schema_high_prio_roots() ->
|
||||||
Roots = emqx_schema:roots(high),
|
Roots = emqx_schema:roots(high),
|
||||||
Authz =
|
Authz =
|
||||||
|
|
|
@ -101,23 +101,23 @@ namespace() -> "bridge_redis".
|
||||||
roots() -> [].
|
roots() -> [].
|
||||||
|
|
||||||
fields("post_single") ->
|
fields("post_single") ->
|
||||||
method_fileds(post, redis_single);
|
method_fields(post, redis_single);
|
||||||
fields("post_sentinel") ->
|
fields("post_sentinel") ->
|
||||||
method_fileds(post, redis_sentinel);
|
method_fields(post, redis_sentinel);
|
||||||
fields("post_cluster") ->
|
fields("post_cluster") ->
|
||||||
method_fileds(post, redis_cluster);
|
method_fields(post, redis_cluster);
|
||||||
fields("put_single") ->
|
fields("put_single") ->
|
||||||
method_fileds(put, redis_single);
|
method_fields(put, redis_single);
|
||||||
fields("put_sentinel") ->
|
fields("put_sentinel") ->
|
||||||
method_fileds(put, redis_sentinel);
|
method_fields(put, redis_sentinel);
|
||||||
fields("put_cluster") ->
|
fields("put_cluster") ->
|
||||||
method_fileds(put, redis_cluster);
|
method_fields(put, redis_cluster);
|
||||||
fields("get_single") ->
|
fields("get_single") ->
|
||||||
method_fileds(get, redis_single);
|
method_fields(get, redis_single);
|
||||||
fields("get_sentinel") ->
|
fields("get_sentinel") ->
|
||||||
method_fileds(get, redis_sentinel);
|
method_fields(get, redis_sentinel);
|
||||||
fields("get_cluster") ->
|
fields("get_cluster") ->
|
||||||
method_fileds(get, redis_cluster);
|
method_fields(get, redis_cluster);
|
||||||
fields(Type) when
|
fields(Type) when
|
||||||
Type == redis_single orelse Type == redis_sentinel orelse Type == redis_cluster
|
Type == redis_single orelse Type == redis_sentinel orelse Type == redis_cluster
|
||||||
->
|
->
|
||||||
|
@ -126,16 +126,16 @@ fields(Type) when
|
||||||
fields("creation_opts_" ++ Type) ->
|
fields("creation_opts_" ++ Type) ->
|
||||||
resource_creation_fields(Type).
|
resource_creation_fields(Type).
|
||||||
|
|
||||||
method_fileds(post, ConnectorType) ->
|
method_fields(post, ConnectorType) ->
|
||||||
redis_bridge_common_fields(ConnectorType) ++
|
redis_bridge_common_fields(ConnectorType) ++
|
||||||
connector_fields(ConnectorType) ++
|
connector_fields(ConnectorType) ++
|
||||||
type_name_fields(ConnectorType);
|
type_name_fields(ConnectorType);
|
||||||
method_fileds(get, ConnectorType) ->
|
method_fields(get, ConnectorType) ->
|
||||||
redis_bridge_common_fields(ConnectorType) ++
|
redis_bridge_common_fields(ConnectorType) ++
|
||||||
connector_fields(ConnectorType) ++
|
connector_fields(ConnectorType) ++
|
||||||
type_name_fields(ConnectorType) ++
|
type_name_fields(ConnectorType) ++
|
||||||
emqx_bridge_schema:status_fields();
|
emqx_bridge_schema:status_fields();
|
||||||
method_fileds(put, ConnectorType) ->
|
method_fields(put, ConnectorType) ->
|
||||||
redis_bridge_common_fields(ConnectorType) ++
|
redis_bridge_common_fields(ConnectorType) ++
|
||||||
connector_fields(ConnectorType).
|
connector_fields(ConnectorType).
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ There are 4 complex data types in EMQX's HOCON config:
|
||||||
1. Array: `[ElementType]`
|
1. Array: `[ElementType]`
|
||||||
|
|
||||||
::: tip Tip
|
::: tip Tip
|
||||||
If map filed name is a positive integer number, it is interpreted as an alternative representation of an `Array`.
|
If map field name is a positive integer number, it is interpreted as an alternative representation of an `Array`.
|
||||||
For example:
|
For example:
|
||||||
```
|
```
|
||||||
myarray.1 = 74
|
myarray.1 = 74
|
||||||
|
@ -120,7 +120,7 @@ If we consider the whole EMQX config as a tree,
|
||||||
to reference a primitive value, we can use a dot-separated names form string for
|
to reference a primitive value, we can use a dot-separated names form string for
|
||||||
the path from the tree-root (always a Struct) down to the primitive values at tree-leaves.
|
the path from the tree-root (always a Struct) down to the primitive values at tree-leaves.
|
||||||
|
|
||||||
Each segment of the dotted string is a Struct filed name or Map key.
|
Each segment of the dotted string is a Struct field name or Map key.
|
||||||
For Array elements, 1-based index is used.
|
For Array elements, 1-based index is used.
|
||||||
|
|
||||||
below are some examples
|
below are some examples
|
||||||
|
|
Loading…
Reference in New Issue