Shell: tezos-node identity should read the configuration file

This commit is contained in:
Grégoire Henry 2017-02-27 22:25:22 +01:00
parent 0b27503f30
commit de050bfee1

View File

@ -24,7 +24,7 @@ let generate { Node_config_file.data_dir ; net } =
fail (Node_identity_file.Existent_identity_file identity_file) fail (Node_identity_file.Existent_identity_file identity_file)
else else
let target = Crypto_box.make_target net.expected_pow in let target = Crypto_box.make_target net.expected_pow in
Format.eprintf "Generating a new identity... " ; Format.eprintf "Generating a new identity... (level: %.2f) " net.expected_pow ;
let id = let id =
P2p.Identity.generate_with_animation Format.err_formatter target in P2p.Identity.generate_with_animation Format.err_formatter target in
Node_identity_file.write identity_file id >>=? fun () -> Node_identity_file.write identity_file id >>=? fun () ->
@ -52,6 +52,11 @@ module Term = struct
begin begin
match data_dir, config_file with match data_dir, config_file with
| None, None -> | None, None ->
let default_config =
Node_config_file.default_data_dir // "config.json" in
if Sys.file_exists default_config then
Node_config_file.read default_config
else
return Node_config_file.default_config return Node_config_file.default_config
| None, Some config_file -> | None, Some config_file ->
Node_config_file.read config_file Node_config_file.read config_file