| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- %%-*- mode: erlang -*-
- %% EMQ X R3.0 config mapping
- {mapping, "web.hook.api.url", "emqx_web_hook.url", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.ssl", "emqx_web.hook.ssl", [
- {default, off},
- {datatype, flag}
- ]}.
- {mapping, "web.hook.ssl.cafile", "emqx_web_hook.ssloptions", [
- {default, ""},
- {datatype, string}
- ]}.
- {mapping, "web.hook.ssl.certfile", "emqx_web_hook.ssloptions", [
- {default, ""},
- {datatype, string}
- ]}.
- {mapping, "web.hook.ssl.keyfile", "emqx_web_hook.ssloptions", [
- {default, ""},
- {datatype, string}
- ]}.
- {mapping, "web.hook.encode_payload", "emqx_web_hook.encode_payload", [
- {default, undefined},
- {datatype, {enum, [base62, base64]}}
- ]}.
- {mapping, "web.hook.rule.client.connect.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.client.connack.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.client.connected.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.client.disconnected.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.client.subscribe.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.client.unsubscribe.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.session.subscribed.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.session.unsubscribed.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.session.terminated.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.message.publish.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.message.acked.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.rule.message.delivered.$name", "emqx_web_hook.rules", [
- {datatype, string}
- ]}.
- {mapping, "web.hook.headers.$name", "emqx_web_hook.headers", [
- {datatype, string}
- ]}.
- {translation, "emqx_web_hook.headers", fun(Conf) ->
- Headers = cuttlefish_variable:filter_by_prefix("web.hook.headers", Conf),
- [{K, V} || {[_, _, _, K], V} <- Headers]
- end}.
- {translation, "emqx_web_hook.rules", fun(Conf) ->
- Hooks = cuttlefish_variable:filter_by_prefix("web.hook.rule", Conf),
- lists:map(
- fun({[_, _, _,Name1,Name2, _], Val}) ->
- {lists:concat([Name1,".",Name2]), Val}
- end, Hooks)
- end}.
- {translation, "emqx_web_hook.ssloptions", fun(Conf) ->
- CA = cuttlefish:conf_get("web.hook.ssl.cafile", Conf),
- Cert = cuttlefish:conf_get("web.hook.ssl.certfile", Conf),
- Key = cuttlefish:conf_get("web.hook.ssl.keyfile", Conf),
- case ((Cert == "") or (Key == "")) of
- true -> [{cacertfile, CA}];
- _ -> [{cacertfile, CA}, {certfile, Cert}, {keyfile, Key}]
- end
- end}.
|