Forráskód Böngészése

refactor: the MongoDB connector into its own application

Kjell Winblad 2 éve
szülő
commit
b78a75bb5c

+ 2 - 1
apps/emqx_authn/rebar.config

@@ -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}]}.

+ 1 - 1
apps/emqx_authn/src/emqx_authn.app.src

@@ -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"]},

+ 2 - 1
apps/emqx_authz/rebar.config

@@ -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, [

+ 2 - 1
apps/emqx_authz/src/emqx_authz.app.src

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

+ 1 - 0
apps/emqx_bridge_mongodb/rebar.config

@@ -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"}}
        ]}.
 

+ 1 - 1
apps/emqx_bridge_mongodb/src/emqx_bridge_mongodb.app.src

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

+ 0 - 1
apps/emqx_connector/docker-ct

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

+ 0 - 1
apps/emqx_connector/rebar.config

@@ -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"}}}
 ]}.

+ 15 - 0
apps/emqx_mongodb/README.md

@@ -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).

+ 1 - 0
apps/emqx_mongodb/docker-ct

@@ -0,0 +1 @@
+mongo

+ 7 - 0
apps/emqx_mongodb/rebar.config

@@ -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"}}}
+       ]}.

+ 1 - 1
apps/emqx_connector/src/emqx_connector_mongo.erl

@@ -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").

+ 16 - 0
apps/emqx_mongodb/src/emqx_mongodb.app.src

@@ -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, []}
+]}.

apps/emqx_connector/test/emqx_connector_mongo_SUITE.erl → apps/emqx_mongodb/test/emqx_connector_mongo_SUITE.erl


apps/emqx_connector/test/emqx_connector_mongo_tests.erl → apps/emqx_mongodb/test/emqx_connector_mongo_tests.erl


+ 1 - 1
apps/emqx_oracle/README.md

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

+ 1 - 0
mix.exs

@@ -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: []) ++

+ 1 - 0
rebar.config.erl

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