Slf/packaging1 #12
3 changed files with 36 additions and 6 deletions
|
@ -1 +1,22 @@
|
||||||
[].
|
[
|
||||||
|
{machi, [
|
||||||
|
%% Data directory for all FLUs.
|
||||||
|
{flu_data_dir, "{{platform_data_dir}}"},
|
||||||
|
|
||||||
|
%% FLUs to start at app start.
|
||||||
|
{initial_flus, [
|
||||||
|
%% Remember, this is a list, so separate all tuples
|
||||||
|
%% with a comma.
|
||||||
|
%%
|
||||||
|
%% {Name::atom(), Port::pos_integer(), proplist()}
|
||||||
|
%%
|
||||||
|
%% For example: {my_name_is_a, 12500, []}
|
||||||
|
|
||||||
|
]},
|
||||||
|
|
||||||
|
%% Number of metadata manager processes to run per FLU.
|
||||||
|
%% Default = 10
|
||||||
|
%% {metadata_manager_count, 2}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
].
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
%% External API
|
%% External API
|
||||||
-export([make_package_spec/4,
|
-export([make_package_spec/1, make_package_spec/4,
|
||||||
start_flu_package/1, start_flu_package/4, stop_flu_package/1]).
|
start_flu_package/1, start_flu_package/4, stop_flu_package/1]).
|
||||||
%% Internal API
|
%% Internal API
|
||||||
-export([start_link/4,
|
-export([start_link/4,
|
||||||
|
@ -83,13 +83,18 @@
|
||||||
%% Supervisor callbacks
|
%% Supervisor callbacks
|
||||||
-export([init/1]).
|
-export([init/1]).
|
||||||
|
|
||||||
|
make_package_spec({FluName, TcpPort, Props}) when is_list(Props) ->
|
||||||
|
FluDataDir = get_env(flu_data_dir, undefined_is_invalid),
|
||||||
|
MyDataDir = filename:join(FluDataDir, atom_to_list(FluName)),
|
||||||
|
make_package_spec(FluName, TcpPort, MyDataDir, Props).
|
||||||
|
|
||||||
make_package_spec(FluName, TcpPort, DataDir, Props) ->
|
make_package_spec(FluName, TcpPort, DataDir, Props) ->
|
||||||
{FluName, {machi_flu_psup, start_link,
|
{FluName, {machi_flu_psup, start_link,
|
||||||
[FluName, TcpPort, DataDir, Props]},
|
[FluName, TcpPort, DataDir, Props]},
|
||||||
permanent, ?SHUTDOWN, supervisor, []}.
|
permanent, ?SHUTDOWN, supervisor, []}.
|
||||||
|
|
||||||
start_flu_package(#p_srvr{name=FluName, port=TcpPort, props=Props}) ->
|
start_flu_package(#p_srvr{name=FluName, port=TcpPort, props=Props}) ->
|
||||||
DataDir = proplists:get_value(data_dir, Props),
|
DataDir = get_data_dir(Props),
|
||||||
start_flu_package(FluName, TcpPort, DataDir, Props).
|
start_flu_package(FluName, TcpPort, DataDir, Props).
|
||||||
|
|
||||||
start_flu_package(FluName, TcpPort, DataDir, Props) ->
|
start_flu_package(FluName, TcpPort, DataDir, Props) ->
|
||||||
|
@ -169,3 +174,9 @@ get_env(Setting, Default) ->
|
||||||
undefined -> Default;
|
undefined -> Default;
|
||||||
{ok, V} -> V
|
{ok, V} -> V
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
get_data_dir(Props) ->
|
||||||
|
case proplists:get_value(data_dir, Props) of
|
||||||
|
Path when is_list(Path) ->
|
||||||
|
Path
|
||||||
|
end.
|
||||||
|
|
|
@ -60,9 +60,7 @@ init([]) ->
|
||||||
{read_concurrency,true}]),
|
{read_concurrency,true}]),
|
||||||
|
|
||||||
Ps = get_initial_flus(),
|
Ps = get_initial_flus(),
|
||||||
FLU_specs = [machi_flu_psup:make_package_spec(FluName, TcpPort,
|
FLU_specs = [machi_flu_psup:make_package_spec(P) || P <- Ps],
|
||||||
DataDir, Props) ||
|
|
||||||
{FluName, TcpPort, DataDir, Props} <- Ps],
|
|
||||||
|
|
||||||
{ok, {SupFlags, FLU_specs}}.
|
{ok, {SupFlags, FLU_specs}}.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue