Account-specific cache file, bugfixes, better error info
add gmhc_lib.erl
This commit is contained in:
+7
-6
@@ -63,7 +63,7 @@ cache_good_address(#{host := Addr,
|
||||
|
||||
invalidate_cache() ->
|
||||
CacheF = cache_filename(),
|
||||
case file:delete_file(CacheF) of
|
||||
case file:delete(CacheF) of
|
||||
ok ->
|
||||
?LOG_DEBUG("Eureka cache file removed (~p)", [CacheF]),
|
||||
ok;
|
||||
@@ -73,17 +73,18 @@ invalidate_cache() ->
|
||||
end.
|
||||
|
||||
cache_filename() ->
|
||||
filename:join(setup:data_dir(), "gmhc_eureka.cache").
|
||||
<<"ak_", PKShort:8/binary, _/binary>> = gmhc_config:get_config([<<"pubkey">>]),
|
||||
filename:join(setup:data_dir(), "gmhc_eureka." ++ binary_to_list(PKShort) ++ ".cache").
|
||||
|
||||
get_pool_address_() ->
|
||||
case gmconfig:find_config([<<"pool_admin">>, <<"url">>], [user_config]) of
|
||||
{ok, URL0} ->
|
||||
case expand_url(URL0) of
|
||||
<<"local">> ->
|
||||
#{host => <<"127.0.0.1">>,
|
||||
port => gmconfig:get_config(
|
||||
[<<"pool">>, <<"port">>], [schema_default]),
|
||||
pool_id => gmhc_config:get_config([<<"pool">>, <<"id">>]) };
|
||||
{ok, #{host => <<"127.0.0.1">>,
|
||||
port => gmconfig:get_config(
|
||||
[<<"pool">>, <<"port">>], [schema_default]),
|
||||
pool_id => gmhc_config:get_config([<<"pool">>, <<"id">>]) }};
|
||||
URL ->
|
||||
?LOG_INFO("Trying to connect to ~p", [URL]),
|
||||
connect1(URL)
|
||||
|
||||
Reference in New Issue
Block a user