Merge branch 'dev' of github.com:emqtt/emqtt into dev

This commit is contained in:
Feng 2015-08-06 00:55:24 +08:00
commit 80f0ebe3b3
12 changed files with 25 additions and 55 deletions

6
.gitmodules vendored
View File

@ -1,3 +1,9 @@
[submodule "plugins/emqttd_dashboard"]
path = plugins/emqttd_dashboard
url = https://github.com/emqtt/emqttd_dashboard.git
[submodule "plugins/emysql"]
path = plugins/emysql
url = https://github.com/erylee/emysql.git
[submodule "plugins/emqttd_plugin_mysql"]
path = plugins/emqttd_plugin_mysql
url = https://github.com/emqtt/emqttd_plugin_mysql.git

View File

@ -29,11 +29,14 @@ edoc:
@$(REBAR) doc
rel: compile
@cd rel && ../rebar generate -f
@cd rel && $(REBAR) generate -f
plugins:
@for plugin in ./plugins/* ; do \
if [ -d $${plugin} ]; then \
echo "copy $${plugin}"; \
cp -R $${plugin} $(DIST)/plugins/ && rm -rf $(DIST)/$${plugin}/src/ ; \
fi \
done
dist: rel plugins

4
PLUGIN.md Normal file
View File

@ -0,0 +1,4 @@
Please see [Plugin Design](https://github.com/emqtt/emqttd/wiki/Plugin%20Design).

@ -0,0 +1 @@
Subproject commit 2d3c9aeabeb5289b9ae27c503f017ad71bd81174

@ -0,0 +1 @@
Subproject commit 892810dbc853ba147f9acabecd52bb51218275e2

1
plugins/emysql Submodule

@ -0,0 +1 @@
Subproject commit 38927104b44b3f8d237bcf3a2b50f2e0608291b3

View File

@ -141,13 +141,6 @@ case "$1" in
echo $RES
exit 1
fi
# Sanity check the plugins.config file
RES=`$NODETOOL_LITE chkconfig $RUNNER_ETC_DIR/plugins.config`
if [ $? != 0 ]; then
echo "Error reading $RUNNER_ETC_DIR/plugins.config"
echo $RES
exit 1
fi
HEART_COMMAND="$RUNNER_SCRIPT_DIR/$SCRIPT start"
export HEART_COMMAND
mkdir -p $PIPE_DIR
@ -265,13 +258,6 @@ case "$1" in
echo $RES
exit 1
fi
# Sanity check the plugins.config file
RES=`$NODETOOL_LITE chkconfig $RUNNER_ETC_DIR/plugins.config`
if [ $? != 0 ]; then
echo "Error reading $RUNNER_ETC_DIR/plugins.config"
echo $RES
exit 1
fi
# Setup beam-required vars
ROOTDIR=$RUNNER_BASE_DIR
ERL_LIBS=$ROOTDIR/plugins
@ -279,7 +265,7 @@ case "$1" in
EMU=beam
PROGNAME=`echo $0 | sed 's/.*\///'`
CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$SCRIPT \
-embedded -config $RUNNER_ETC_DIR/emqttd.config -config $RUNNER_ETC_DIR/plugins.config \
-embedded -config $RUNNER_ETC_DIR/emqttd.config \
-pa $RUNNER_LIB_DIR/basho-patches \
-args_file $RUNNER_ETC_DIR/vm.args -- ${1+"$@"}"
export EMU
@ -305,13 +291,6 @@ case "$1" in
echo $RES
exit 1
fi
# Sanity check the plugins.config file
RES=`$NODETOOL_LITE chkconfig $RUNNER_ETC_DIR/plugins.config`
if [ $? != 0 ]; then
echo "Error reading $RUNNER_ETC_DIR/plugins.config"
echo $RES
exit 1
fi
echo "config is OK"
;;
escript)

View File

@ -165,7 +165,7 @@
%% Plugins
{plugins, [
{dir, "./plugins"},
{loaded_file, "./data/loaded_plugins"}
{loaded_file, "./data/plugins.config"}
]},
%% Listeners
{listeners, [

View File

@ -1,26 +1 @@
[
% {emysql, [
% {pool_size, 4},
% {host, "localhost"},
% {port, 3306},
% {username, "root"},
% {password, "public"},
% {database, "mqtt"},
% {encoding, utf8}
% ]},
% {emqttd_auth_mysql, [
% {user_table, mqtt_users},
% {password_hash, plain},
% {field_mapper, [
% {username, username},
% {password, password}
% ]}
% ]},
% {emqttd_dashboard, [
% {listener,
% {emqttd_dashboard, 18083, [
% {acceptors, 4},
% {max_clients, 512}]}}
% ]}
%
].
emqttd_dashboard.

View File

@ -87,7 +87,6 @@
{template, "files/acl.config", "etc/acl.config"},
{template, "files/rewrite.config", "etc/rewrite.config"},
{template, "files/clients.config", "etc/clients.config"},
{template, "files/plugins.config", "etc/plugins.config"},
{template, "files/vm.args", "etc/vm.args"},
{copy, "files/loaded_plugins", "data/loaded_plugins"}
{copy, "files/plugins.config", "data/plugins.config"}
]}.

View File

@ -213,8 +213,9 @@ read_loaded() ->
write_loaded(AppNames) ->
case file:open(env(loaded_file), [binary, write]) of
{ok, Fd} ->
Line = list_to_binary(io_lib:format("~w.~n", [AppNames])),
file:write(Fd, Line);
lists:foreach(fun(Name) ->
file:write(Fd, iolist_to_binary(io_lib:format("~s.~n", [Name])))
end, AppNames);
{error, Error} ->
{error, Error}
end.

View File

@ -57,6 +57,6 @@ start_session(CleanSess, ClientId, ClientPid) ->
init([]) ->
{ok, {{simple_one_for_one, 10, 10},
[{session, {emqttd_session, start_link, []},
transient, 10000, worker, [emqttd_session]}]}}.
temporary, 10000, worker, [emqttd_session]}]}}.