Compare commits

..

2 Commits

4 changed files with 29 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{application,gmhive_client, {application,gmhive_client,
[{description,"Gajumaru Hive Client"}, [{description,"Gajumaru Hive Client"},
{vsn,"0.6.1"}, {vsn,"0.6.2"},
{registered,[]}, {registered,[]},
{applications,[kernel,stdlib,sasl,gproc,inets,ssl,enoise, {applications,[kernel,stdlib,sasl,gproc,inets,ssl,enoise,
gmconfig,gmhive_protocol,gmhive_worker]}, gmconfig,gmhive_protocol,gmhive_worker]},

View File

@ -45,6 +45,7 @@ stop(_State) ->
ok. ok.
set_things_up() -> set_things_up() ->
maybe_add_logger_handler(),
gmhc_counters:initialize(), gmhc_counters:initialize(),
gmhc_config:load_config(), gmhc_config:load_config(),
logger:set_module_level([gmhw_pow_cuckoo], notice), logger:set_module_level([gmhw_pow_cuckoo], notice),
@ -59,3 +60,16 @@ set_things_up() ->
_ -> ok _ -> ok
end, end,
ok. ok.
maybe_add_logger_handler() ->
case is_headless() orelse application:get_env(gmhive_client, tty_logger, false) of
true ->
Level = application:get_env(gmhive_client, tty_logger_level, error),
io:fwrite("Adding logger handler: ~p~n", [Level]),
logger:add_handler(gmhc_tty, logger_std_h, #{level => Level});
false ->
ok
end.
is_headless() ->
undefined == application:get_key(gajumine, vsn).

View File

@ -14,8 +14,20 @@ load_config() ->
gmconfig:apply_os_env(), gmconfig:apply_os_env(),
gmconfig:process_plain_args(), gmconfig:process_plain_args(),
check_application_env(), check_application_env(),
check_final_config(),
ok. ok.
check_final_config() ->
ExtraPubkeys = get_config([<<"extra_pubkeys">>]),
AllKeys = [get_config([<<"pubkey">>]) | ExtraPubkeys],
case AllKeys -- lists:usort(AllKeys) of
[] ->
ok;
Duplicates ->
?LOG_ERROR("Duplicate account ids found: ~p", [Duplicates]),
error({duplicate_account_ids, Duplicates})
end.
instrument_gmconfig() -> instrument_gmconfig() ->
gmconfig:set_gmconfig_env(gmconfig_env()). gmconfig:set_gmconfig_env(gmconfig_env()).

View File

@ -1,10 +1,10 @@
{name,"gmhive_client"}. {name,"gmhive_client"}.
{type,app}. {type,app}.
{modules,[]}. {modules,[]}.
{prefix,"gmhc"}.
{author,"Ulf Wiger, QPQ AG"}. {author,"Ulf Wiger, QPQ AG"}.
{prefix,"gmhc"}.
{desc,"Gajumaru Hive Client"}. {desc,"Gajumaru Hive Client"}.
{package_id,{"uwiger","gmhive_client",{0,6,1}}}. {package_id,{"uwiger","gmhive_client",{0,6,2}}}.
{deps,[{"uwiger","gmhive_worker",{0,5,1}}, {deps,[{"uwiger","gmhive_worker",{0,5,1}},
{"uwiger","gmcuckoo",{1,2,4}}, {"uwiger","gmcuckoo",{1,2,4}},
{"otpr","eblake2",{1,0,1}}, {"otpr","eblake2",{1,0,1}},