This commit is contained in:
Daniil Fedotov 2017-05-08 16:36:56 +01:00
parent ec5ea5e35e
commit 2604ef9bff
2 changed files with 5 additions and 3 deletions

View File

@ -55,7 +55,7 @@ and a refresh interval:
Setting `refresh_interval` to `0` seconds will disable automatic refresh.
Certificates are distinguished by their **filenames**, file modification time and
a certificate hash.
the hash of file contents.
#### Installing a Certificate

View File

@ -49,7 +49,9 @@ list_certs_0(Path) ->
lists:map(
fun(FileName) ->
AbsName = filename:absname(FileName, Path),
CertId = {FileName, modification_time(AbsName), file_hash(AbsName)},
CertId = {FileName,
modification_time(AbsName),
file_content_hash(AbsName)},
{CertId, [{name, FileName}]}
end,
FileNames).
@ -58,7 +60,7 @@ modification_time(Path) ->
{ok, Info} = file:read_file_info(Path, [{time, posix}]),
Info#file_info.mtime.
file_hash(Path) ->
file_content_hash(Path) ->
{ok, Data} = file:read_file(Path),
erlang:phash2(Data).