Client: use TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER=Y to disable the banner

This commit is contained in:
Benjamin Canou 2018-06-29 17:00:04 +02:00
parent 797b26c16c
commit e1195e6f3e
2 changed files with 71 additions and 61 deletions

View File

@ -9,68 +9,76 @@
open Client_config open Client_config
let disable_disclaimer =
match Sys.getenv_opt "TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER" with
| Some ("yes" | "y" | "YES" | "Y") -> true
| _ -> false
let display_warning_banner ctxt = let display_warning_banner ctxt =
let default () = if disable_disclaimer then
Format.eprintf Lwt.return ()
"@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\ else
\ This is @{<warning>NOT@} the Tezos Mainnet.@,\ let default () =
\ The Tezos Mainnet is not yet released.@,\ Format.eprintf
@,\ "@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\
\ Use your fundraiser keys @{<warning>AT YOUR OWN RISK@}.@,\ \ This is @{<warning>NOT@} the Tezos Mainnet.@,\
All transactions happening on the Betanet @{<warning>are expected to be valid in the Mainnet@}.@,\ \ The Tezos Mainnet is not yet released.@,\
\ In doubt, we recommend that you wait for the lunch of the Mainnet.@]@\n@." ; @,\
Lwt.return_unit in \ Use your fundraiser keys @{<warning>AT YOUR OWN RISK@}.@,\
Shell_services.P2p.versions ctxt >>= function All transactions happening on the Betanet @{<warning>are expected to be valid in the Mainnet@}.@,\
| Error _ -> default () \ In doubt, we recommend that you wait for the lunch of the Mainnet.@]@\n@." ;
| Ok versions -> Lwt.return_unit in
match String.split_on_char '_' (List.hd versions).name with Shell_services.P2p.versions ctxt >>= function
| "TEZOS" :: "ZERONET" :: _date :: [] -> | Error _ -> default ()
Format.eprintf | Ok versions ->
"@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\ match String.split_on_char '_' (List.hd versions).name with
\ This is @{<warning>NOT@} the Tezos Mainnet.@,\ | "TEZOS" :: "ZERONET" :: _date :: [] ->
\ The Tezos Mainnet is not yet released.@,\ Format.eprintf
@,\ "@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\
\ The node you are connecting to claims to be running on the@,\ \ This is @{<warning>NOT@} the Tezos Mainnet.@,\
\ @{<warning>Tezos Zeronet DEVELOPMENT NETWORK@}.@,\ \ The Tezos Mainnet is not yet released.@,\
\ Do @{<warning>NOT@} use your fundraiser keys on this network.@,\ @,\
Zeronet is a testing network, with free tokens and frequent resets.@]@\n@." ; \ The node you are connecting to claims to be running on the@,\
Lwt.return_unit \ @{<warning>Tezos Zeronet DEVELOPMENT NETWORK@}.@,\
| "TEZOS" :: "ALPHANET" :: _date :: [] -> \ Do @{<warning>NOT@} use your fundraiser keys on this network.@,\
Format.eprintf Zeronet is a testing network, with free tokens and frequent resets.@]@\n@." ;
"@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\ Lwt.return_unit
\ This is @{<warning>NOT@} the Tezos Mainnet.@,\ | "TEZOS" :: "ALPHANET" :: _date :: [] ->
\ The Tezos Mainnet is not yet released.@,\ Format.eprintf
@,\ "@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\
\ The node you are connecting to claims to be running on the@,\ \ This is @{<warning>NOT@} the Tezos Mainnet.@,\
\ @{<warning>Tezos Alphanet DEVELOPMENT NETWORK.@}@,\ \ The Tezos Mainnet is not yet released.@,\
\ Do @{<warning>NOT@} use your fundraiser keys on this network.@,\ @,\
\ Alphanet is a testing network, with free tokens.@]@\n@." ; \ The node you are connecting to claims to be running on the@,\
Lwt.return_unit \ @{<warning>Tezos Alphanet DEVELOPMENT NETWORK.@}@,\
| "TEZOS" :: "BETANET" :: _date :: [] -> \ Do @{<warning>NOT@} use your fundraiser keys on this network.@,\
Format.eprintf \ Alphanet is a testing network, with free tokens.@]@\n@." ;
"@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\ Lwt.return_unit
\ This is @{<warning>NOT@} the Tezos Mainnet.@,\ | "TEZOS" :: "BETANET" :: _date :: [] ->
\ The Tezos Mainnet is not yet released.@,\ Format.eprintf
@,\ "@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\
\ The node you are connecting to claims to be running on the@,\ \ This is @{<warning>NOT@} the Tezos Mainnet.@,\
\ @{<warning>Tezos Betanet EXPERIMENTAL NETWORK@}.@,\ \ The Tezos Mainnet is not yet released.@,\
\ Betanet is a pre-release experimental network and comes with no warranty.@,\ @,\
\ Use your fundraiser keys on this network @{<warning>AT YOUR OWN RISK@}.@,\ \ The node you are connecting to claims to be running on the@,\
\ All transactions happening on the Betanet @{<warning>are expected to be valid in the Mainnet@}.@,\ \ @{<warning>Tezos Betanet EXPERIMENTAL NETWORK@}.@,\
\ If in doubt, we recommend that you wait for the Mainnet lunch.@]@\n@." ; \ Betanet is a pre-release experimental network and comes with no warranty.@,\
Lwt.return_unit \ Use your fundraiser keys on this network @{<warning>AT YOUR OWN RISK@}.@,\
| "TEZOS" :: _date :: [] -> \ All transactions happening on the Betanet @{<warning>are expected to be valid in the Mainnet@}.@,\
Format.eprintf \ If in doubt, we recommend that you wait for the Mainnet lunch.@]@\n@." ;
"@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\ Lwt.return_unit
\ This is @{<warning>NOT@} the Tezos Mainnet.@,\ | "TEZOS" :: _date :: [] ->
\ The Tezos Mainnet is not yet released.@,\ Format.eprintf
@,\ "@[<v 2>@{<warning>@{<title>Warning@}@}@,@,\
\ The node you are connecting to claims to be running in a@,\ \ This is @{<warning>NOT@} the Tezos Mainnet.@,\
\ @{<warning>Tezos TEST SANDBOX@}.@,\ \ The Tezos Mainnet is not yet released.@,\
\ Do @{<warning>NOT@} use your fundraiser keys on this network.@,\ @,\
You should not see this message if you are not a developer.@]@\n@." ; \ The node you are connecting to claims to be running in a@,\
Lwt.return_unit \ @{<warning>Tezos TEST SANDBOX@}.@,\
| _ -> default () \ Do @{<warning>NOT@} use your fundraiser keys on this network.@,\
You should not see this message if you are not a developer.@]@\n@." ;
Lwt.return_unit
| _ -> default ()
let get_commands_for_version ctxt block protocol = let get_commands_for_version ctxt block protocol =
Shell_services.Blocks.protocols ctxt ~block () >>= function Shell_services.Blocks.protocols ctxt ~block () >>= function

View File

@ -7,6 +7,8 @@ cd "$test_dir"
sandbox_file="$test_dir/sandbox.json" sandbox_file="$test_dir/sandbox.json"
parameters_file="$test_dir/protocol_parameters.json" parameters_file="$test_dir/protocol_parameters.json"
export TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER=Y
tezos_sandboxed_node="${1:-$test_dir/../../bin_node/tezos-sandboxed-node.sh}" tezos_sandboxed_node="${1:-$test_dir/../../bin_node/tezos-sandboxed-node.sh}"
local_node="${2:-$test_dir/../../../_build/default/src/bin_node/main.exe}" local_node="${2:-$test_dir/../../../_build/default/src/bin_node/main.exe}"
tezos_init_sandboxed_client="${3:-$test_dir/../../bin_client/tezos-init-sandboxed-client.sh}" tezos_init_sandboxed_client="${3:-$test_dir/../../bin_client/tezos-init-sandboxed-client.sh}"