-
Notifications
You must be signed in to change notification settings - Fork 0
/
rebar.config.script
30 lines (22 loc) · 1.23 KB
/
rebar.config.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
%% -*- mode: erlang -*-
%% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et
%% Utility function to merge config items
AddConfigKey =
fun(Key, Value, C) ->
lists:keystore(Key, 1, C, {Key, Value})
end,
%% As an easy way to cluster our nodes we'll generate the node names for each node and place them in each nodes config
%% this saves writing an auto-discovery feature that uses UDP (across machines) or using some external piece of software
%% like Redis / ZooKeeper etc as a registry for node names
NumNodes = proplists:get_value(num_nodes, CONFIG, 3),
%ShortNodeNames = [ list_to_atom("es3_" ++ integer_to_list(N)) || N <- lists:seq(1, NumNodes) ],
%Config2 = AddConfigKey(node_names, ShortNodeNames, CONFIG),
RelxConfig = proplists:get_value(relx, CONFIG),
RelxConfig2 = proplists:delete(release, RelxConfig),
FilestoreVersion = proplists:get_value(vsn, CONFIG, "0.0.1"),
ReleaseConfig = lists:foldl(fun(Index, Acc) ->
[{release, {list_to_atom("filestore" ++ integer_to_list(Index)), FilestoreVersion} , [filestore]}] ++ Acc
end, [], lists:seq(1, NumNodes)),
RelxConfig3 = lists:reverse(ReleaseConfig) ++ RelxConfig2,
lists:keyreplace(relx, 1, CONFIG, {relx, RelxConfig3}).