This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch aegis_key_manager_app
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit bd536782778ff9bfd7ed2d7022915942389151b6
Author: Robert Newson <[email protected]>
AuthorDate: Tue Aug 4 12:18:40 2020 +0100

    Optionally add a key manager application as a dependency
---
 .../src/{aegis.app.src => aegis.app.src.script}    | 33 +++++++++++++++++-----
 1 file changed, 26 insertions(+), 7 deletions(-)

diff --git a/src/aegis/src/aegis.app.src b/src/aegis/src/aegis.app.src.script
similarity index 62%
rename from src/aegis/src/aegis.app.src
rename to src/aegis/src/aegis.app.src.script
index deb1526..f54688c 100644
--- a/src/aegis/src/aegis.app.src
+++ b/src/aegis/src/aegis.app.src.script
@@ -10,6 +10,31 @@
 % License for the specific language governing permissions and limitations under
 % the License.
 
+CouchConfig = case filelib:is_file(os:getenv("COUCHDB_CONFIG")) of
+    true ->
+        {ok, Result} = file:consult(os:getenv("COUCHDB_CONFIG")),
+        Result;
+    false ->
+        []
+end.
+
+AegisKeyManagerApp = case lists:keyfind(aegis_key_manager_app, 1, CouchConfig) 
of
+    {aegis_key_manager_app, AppName} when AppName /= "" ->
+        [list_to_atom(AppName)];
+    _ ->
+        []
+end.
+
+BaseApplications = [
+    kernel,
+    stdlib,
+    crypto,
+    couch_log,
+    erlfdb
+].
+
+Applications = AegisKeyManagerApp ++ BaseApplications.
+
 {application, aegis,
  [
   {description, "If it's good enough for Zeus, it's good enough for CouchDB"},
@@ -18,13 +43,7 @@
   {registered, [
     aegis_server
   ]},
-  {applications,
-   [kernel,
-    stdlib,
-    crypto,
-    couch_log,
-    erlfdb
-   ]},
+  {applications, Applications},
   {env,[]},
   {modules, []},
   {maintainers, []},

Reply via email to