fix(s3-bridge): restore backward config compatibility
This commit is contained in:
parent
d4acceb858
commit
8016e9adf4
|
@ -63,10 +63,14 @@ fields(action) ->
|
||||||
fields(?ACTION) ->
|
fields(?ACTION) ->
|
||||||
emqx_bridge_v2_schema:make_producer_action_schema(
|
emqx_bridge_v2_schema:make_producer_action_schema(
|
||||||
hoconsc:mk(
|
hoconsc:mk(
|
||||||
mkunion(mode, #{
|
mkunion(
|
||||||
|
mode,
|
||||||
|
#{
|
||||||
<<"direct">> => ?R_REF(s3_direct_upload_parameters),
|
<<"direct">> => ?R_REF(s3_direct_upload_parameters),
|
||||||
<<"aggregated">> => ?R_REF(s3_aggregated_upload_parameters)
|
<<"aggregated">> => ?R_REF(s3_aggregated_upload_parameters)
|
||||||
}),
|
},
|
||||||
|
<<"direct">>
|
||||||
|
),
|
||||||
#{
|
#{
|
||||||
required => true,
|
required => true,
|
||||||
desc => ?DESC(s3_upload),
|
desc => ?DESC(s3_upload),
|
||||||
|
@ -87,7 +91,7 @@ fields(s3_direct_upload_parameters) ->
|
||||||
hoconsc:mk(
|
hoconsc:mk(
|
||||||
direct,
|
direct,
|
||||||
#{
|
#{
|
||||||
required => true,
|
default => <<"direct">>,
|
||||||
desc => ?DESC(s3_direct_upload_mode)
|
desc => ?DESC(s3_direct_upload_mode)
|
||||||
}
|
}
|
||||||
)},
|
)},
|
||||||
|
@ -187,13 +191,22 @@ fields(s3_upload_resource_opts) ->
|
||||||
]).
|
]).
|
||||||
|
|
||||||
mkunion(Field, Schemas) ->
|
mkunion(Field, Schemas) ->
|
||||||
hoconsc:union(fun(Arg) -> scunion(Field, Schemas, Arg) end).
|
mkunion(Field, Schemas, none).
|
||||||
|
|
||||||
scunion(_Field, Schemas, all_union_members) ->
|
mkunion(Field, Schemas, Default) ->
|
||||||
|
hoconsc:union(fun(Arg) -> scunion(Field, Schemas, Default, Arg) end).
|
||||||
|
|
||||||
|
scunion(_Field, Schemas, _Default, all_union_members) ->
|
||||||
maps:values(Schemas);
|
maps:values(Schemas);
|
||||||
scunion(Field, Schemas, {value, Value}) ->
|
scunion(Field, Schemas, Default, {value, Value}) ->
|
||||||
Selector = maps:get(emqx_utils_conv:bin(Field), Value, undefined),
|
Selector =
|
||||||
case Selector == undefined orelse maps:find(emqx_utils_conv:bin(Selector), Schemas) of
|
case maps:get(emqx_utils_conv:bin(Field), Value, undefined) of
|
||||||
|
undefined ->
|
||||||
|
Default;
|
||||||
|
X ->
|
||||||
|
emqx_utils_conv:bin(X)
|
||||||
|
end,
|
||||||
|
case maps:find(Selector, Schemas) of
|
||||||
{ok, Schema} ->
|
{ok, Schema} ->
|
||||||
[Schema];
|
[Schema];
|
||||||
_Error ->
|
_Error ->
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
node {
|
||||||
|
name = "emqx@127.0.0.1"
|
||||||
|
cookie = "emqxsecretcookie"
|
||||||
|
data_dir = "data"
|
||||||
|
}
|
||||||
|
|
||||||
|
actions {
|
||||||
|
s3 {
|
||||||
|
s3direct {
|
||||||
|
connector = s3local
|
||||||
|
enable = true
|
||||||
|
parameters {
|
||||||
|
acl = private
|
||||||
|
bucket = direct
|
||||||
|
content = "${.}"
|
||||||
|
headers {}
|
||||||
|
key = "${clientid}/${id}"
|
||||||
|
}
|
||||||
|
resource_opts {
|
||||||
|
health_check_interval = 15s
|
||||||
|
inflight_window = 100
|
||||||
|
max_buffer_bytes = 256MB
|
||||||
|
query_mode = async
|
||||||
|
request_ttl = 45s
|
||||||
|
worker_pool_size = 16
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connectors {
|
||||||
|
s3 {
|
||||||
|
s3local {
|
||||||
|
access_key_id = ACCESS
|
||||||
|
host = localhost
|
||||||
|
port = 9000
|
||||||
|
resource_opts {health_check_interval = 15s, start_timeout = 5s}
|
||||||
|
secret_access_key = SECRET
|
||||||
|
transport_options {
|
||||||
|
connect_timeout = 15s
|
||||||
|
enable_pipelining = 100
|
||||||
|
headers {}
|
||||||
|
ipv6_probe = false
|
||||||
|
pool_size = 8
|
||||||
|
pool_type = random
|
||||||
|
ssl {enable = false, verify = verify_peer}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue