Explorar el Código

Allow boolean flag for loaded plugins

This is to simplify config templating
spring2maz hace 7 años
padre
commit
55d2d1d278
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      src/emqx_plugins.erl

+ 5 - 1
src/emqx_plugins.erl

@@ -276,7 +276,11 @@ plugin_unloaded(_Name, false) ->
     ok;
     ok;
 plugin_unloaded(Name, true) ->
 plugin_unloaded(Name, true) ->
     case read_loaded() of
     case read_loaded() of
-        {ok, Names} ->
+        {ok, Names0} ->
+            Names = lists:filtermap(fun(Name) when is_atom(Name) -> {true, Name};
+                                       ({Name, true}) -> {true, Name};
+                                       ({Name, false}) -> false
+                                    end, Names0),
             case lists:member(Name, Names) of
             case lists:member(Name, Names) of
                 true ->
                 true ->
                     write_loaded(lists:delete(Name, Names));
                     write_loaded(lists:delete(Name, Names));