summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Avdey <eiri@eiri.ca>2020-04-16 16:42:04 -0300
committerEric Avdey <eiri@eiri.ca>2020-04-16 23:44:19 -0300
commita8c9d8e933c93a5df4e0e337a44ec59b1656f3b2 (patch)
tree3a867ee8ee36e2303c9359896b8a6885c6b83a70
parent14b1e255ca6f4312b75a18fb3e168e7573ca7d4c (diff)
downloadcouchdb-a8c9d8e933c93a5df4e0e337a44ec59b1656f3b2.tar.gz
Move rebar.config.script from couch to aegis
-rw-r--r--src/aegis/rebar.config.script35
-rw-r--r--src/couch/rebar.config.script11
2 files changed, 36 insertions, 10 deletions
diff --git a/src/aegis/rebar.config.script b/src/aegis/rebar.config.script
new file mode 100644
index 000000000..27752fe81
--- /dev/null
+++ b/src/aegis/rebar.config.script
@@ -0,0 +1,35 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+% use this file except in compliance with the License. You may obtain a copy of
+% the License at
+%
+% http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% 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.
+
+case lists:keyfind(aegis_key_manager, 1, CouchConfig) of
+ {aegis_key_manager, ""} ->
+ CONFIG;
+ {aegis_key_manager, Module} ->
+ CurrentOpts = case lists:keyfind(erl_opts, 1, CONFIG) of
+ {erl_opts, Opts} -> Opts;
+ false -> []
+ end,
+ AegisOpts = {d, 'AEGIS_KEY_MANAGER', list_to_existing_atom(Module)},
+ NewOpts = [AegisOpts | CurrentOpts],
+ lists:keystore(erl_opts, 1, CONFIG, {erl_opts, NewOpts});
+ _ ->
+ CONFIG
+end.
diff --git a/src/couch/rebar.config.script b/src/couch/rebar.config.script
index e281eab38..91e24d99e 100644
--- a/src/couch/rebar.config.script
+++ b/src/couch/rebar.config.script
@@ -92,15 +92,6 @@ MD5Config = case lists:keyfind(erlang_md5, 1, CouchConfig) of
[]
end,
-AegisConfig = case lists:keyfind(crypto_module, 1, CouchConfig) of
- {aegis_key_manager, ""} ->
- [];
- {aegis_key_manager, Module} ->
- [{d, 'AEGIS_KEY_MANAGER', list_to_existing_atom(Module)}];
- _ ->
- []
-end,
-
ProperConfig = case code:lib_dir(proper) of
{error, bad_name} -> [];
_ -> [{d, 'WITH_PROPER'}]
@@ -232,7 +223,7 @@ AddConfig = [
{d, 'COUCHDB_VERSION', Version},
{d, 'COUCHDB_GIT_SHA', GitSha},
{i, "../"}
- ] ++ MD5Config ++ AegisConfig ++ ProperConfig},
+ ] ++ MD5Config ++ ProperConfig},
{port_env, PortEnvOverrides},
{eunit_compile_opts, PlatformDefines}
].