refactor: the MongoDB connector into its own application

This commit is contained in:
Kjell Winblad 2023-05-10 18:22:55 +02:00
parent e3199ef813
commit b78a75bb5c
18 changed files with 52 additions and 9 deletions

View File

@ -3,7 +3,8 @@
{deps, [
{emqx, {path, "../emqx"}},
{emqx_utils, {path, "../emqx_utils"}},
{emqx_connector, {path, "../emqx_connector"}}
{emqx_connector, {path, "../emqx_connector"}},
{emqx_mongodb, {path, "../emqx_mongodb"}}
]}.
{edoc_opts, [{preprocess, true}]}.

View File

@ -4,7 +4,7 @@
{vsn, "0.1.22"},
{modules, []},
{registered, [emqx_authn_sup, emqx_authn_registry]},
{applications, [kernel, stdlib, emqx_resource, emqx_connector, ehttpc, epgsql, mysql, jose]},
{applications, [kernel, stdlib, emqx_resource, emqx_connector, ehttpc, epgsql, mysql, jose, emqx_mongodb]},
{mod, {emqx_authn_app, []}},
{env, []},
{licenses, ["Apache-2.0"]},

View File

@ -4,7 +4,8 @@
{deps, [
{emqx, {path, "../emqx"}},
{emqx_utils, {path, "../emqx_utils"}},
{emqx_connector, {path, "../emqx_connector"}}
{emqx_connector, {path, "../emqx_connector"}},
{emqx_mongodb, {path, "../emqx_mongodb"}}
]}.
{shell, [

View File

@ -9,7 +9,8 @@
stdlib,
crypto,
emqx_resource,
emqx_connector
emqx_connector,
emqx_mongodb
]},
{env, []},
{modules, []},

View File

@ -3,6 +3,7 @@
{deps, [ {emqx_connector, {path, "../../apps/emqx_connector"}}
, {emqx_resource, {path, "../../apps/emqx_resource"}}
, {emqx_bridge, {path, "../../apps/emqx_bridge"}}
, {emqx_mongodb, {path, "../../apps/emqx_mongodb"}}
, {emqx_ee_bridge, {path, "../../lib-ee/emqx_ee_bridge"}}
]}.

View File

@ -8,7 +8,7 @@
emqx_resource,
emqx_bridge,
emqx_ee_bridge,
mongodb]},
emqx_mongodb]},
{env, []},
{modules, []},
{links, []}

View File

@ -1,4 +1,3 @@
mongo
redis
redis_cluster
mysql

View File

@ -12,7 +12,6 @@
{eldap2, {git, "https://github.com/emqx/eldap2", {tag, "v0.2.2"}}},
{mysql, {git, "https://github.com/emqx/mysql-otp", {tag, "1.7.2"}}},
{epgsql, {git, "https://github.com/emqx/epgsql", {tag, "4.7.0.1"}}},
{mongodb, {git, "https://github.com/emqx/mongodb-erlang", {tag, "v3.0.19"}}},
%% NOTE: mind ecpool version when updating eredis_cluster version
{eredis_cluster, {git, "https://github.com/emqx/eredis_cluster", {tag, "0.8.1"}}}
]}.

View File

@ -0,0 +1,15 @@
# MongoDB Connector
This application houses the MongoDB connector. The MongoDB connector is used by
emqx_authz, emqx_authn and emqx_bridge_mongodb applications to connect to
MongoDB.
## Contributing
Please see our [contributing.md](../../CONTRIBUTING.md).
## License
Apache License, Version 2.0
See [APL.txt](../../APL.txt).

View File

@ -0,0 +1 @@
mongo

View File

@ -0,0 +1,7 @@
%% -*- mode: erlang; -*-
{erl_opts, [debug_info]}.
{deps, [ {emqx_connector, {path, "../../apps/emqx_connector"}}
, {emqx_resource, {path, "../../apps/emqx_resource"}}
, {mongodb, {git, "https://github.com/emqx/mongodb-erlang", {tag, "v3.0.19"}}}
]}.

View File

@ -15,7 +15,7 @@
%%--------------------------------------------------------------------
-module(emqx_connector_mongo).
-include("emqx_connector.hrl").
-include_lib("emqx_connector/include/emqx_connector.hrl").
-include_lib("typerefl/include/types.hrl").
-include_lib("hocon/include/hoconsc.hrl").
-include_lib("emqx/include/logger.hrl").

View File

@ -0,0 +1,16 @@
{application, emqx_mongodb, [
{description, "EMQX MongoDB Connector"},
{vsn, "0.1.0"},
{registered, []},
{applications, [
kernel,
stdlib,
mongodb,
emqx_connector,
emqx_resource
]},
{env, []},
{modules, []},
{links, []}
]}.

View File

@ -11,4 +11,4 @@ Please see our [contributing.md](../../CONTRIBUTING.md).
## License
See [BSL](./BSL.txt).
See [BSL](../../APL.txt).

View File

@ -377,6 +377,7 @@ defmodule EMQXUmbrella.MixProject do
emqx_psk: :permanent,
emqx_slow_subs: :permanent,
emqx_plugins: :permanent,
emqx_mongodb: :permanent,
emqx_mix: :none
] ++
if(enable_quicer?(), do: [quicer: :permanent], else: []) ++

View File

@ -439,6 +439,7 @@ relx_apps(ReleaseType, Edition) ->
emqx_prometheus,
emqx_psk,
emqx_slow_subs,
emqx_mongodb,
emqx_plugins
] ++
[quicer || is_quicer_supported()] ++