Add function 'get_caps/3'
This commit is contained in:
parent
ad7e0ae436
commit
cc79802d6c
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
-export([ get_caps/1
|
-export([ get_caps/1
|
||||||
, get_caps/2
|
, get_caps/2
|
||||||
|
, get_caps/3
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export([default/0]).
|
-export([default/0]).
|
||||||
|
@ -114,10 +115,13 @@ get_caps(Zone) ->
|
||||||
-spec(get_caps(emqx_zone:zone(), publish|subscribe) -> caps()).
|
-spec(get_caps(emqx_zone:zone(), publish|subscribe) -> caps()).
|
||||||
get_caps(Zone, publish) ->
|
get_caps(Zone, publish) ->
|
||||||
with_env(Zone, '$mqtt_pub_caps', fun pub_caps/1);
|
with_env(Zone, '$mqtt_pub_caps', fun pub_caps/1);
|
||||||
|
|
||||||
get_caps(Zone, subscribe) ->
|
get_caps(Zone, subscribe) ->
|
||||||
with_env(Zone, '$mqtt_sub_caps', fun sub_caps/1).
|
with_env(Zone, '$mqtt_sub_caps', fun sub_caps/1).
|
||||||
|
|
||||||
|
-spec(get_caps(emqx_zone:zone(), atom(), term()) -> term()).
|
||||||
|
get_caps(Zone, Cap, Def) ->
|
||||||
|
emqx_zone:get_env(Zone, Cap, Def).
|
||||||
|
|
||||||
pub_caps(Zone) ->
|
pub_caps(Zone) ->
|
||||||
filter_caps(?PUBCAP_KEYS, get_caps(Zone)).
|
filter_caps(?PUBCAP_KEYS, get_caps(Zone)).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue