Fix default values for ENV vars

pull/3020/head
Victor Baranov 5 years ago
parent 8b3f4fd7cf
commit 529b47ee59
  1. 5
      .dialyzer-ignore
  2. 6
      apps/block_scout_web/lib/block_scout_web/views/layout_view.ex
  3. 29
      apps/block_scout_web/test/block_scout_web/views/layout_view_test.exs
  4. 2
      apps/explorer/config/config.exs

@ -2,15 +2,14 @@
:0: Unknown function 'Elixir.ExUnit.CaseTemplate':'__proxy__'/2 :0: Unknown function 'Elixir.ExUnit.CaseTemplate':'__proxy__'/2
:0: Unknown type 'Elixir.Map':t/0 :0: Unknown type 'Elixir.Map':t/0
apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex:400: Function timestamp_to_datetime/1 has no local return apps/ethereum_jsonrpc/lib/ethereum_jsonrpc.ex:400: Function timestamp_to_datetime/1 has no local return
lib/block_scout_web/views/layout_view.ex:174: The call 'Elixir.Poison.Parser':'parse!'(any(),#{'keys':='atoms!'}) will never return since the success typing is (binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []),[{atom(),_}]) -> 'false' | 'nil' | 'true' | binary() | ['false' | 'nil' | 'true' | binary() | [any()] | number() | map()] | number() | map() and the contract is (iodata(),'Elixir.Keyword':t()) -> t()
lib/explorer/repo/prometheus_logger.ex:8 lib/explorer/repo/prometheus_logger.ex:8
lib/block_scout_web/views/layout_view.ex:175 lib/block_scout_web/views/layout_view.ex:175
lib/explorer/smart_contract/publisher_worker.ex:6 lib/explorer/smart_contract/publisher_worker.ex:6
apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: Function microseconds_time/1 has no local return apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: Function microseconds_time/1 has no local return
apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: The call 'Elixir.System':convert_time_unit(__@1::any(),'native','microseconds') breaks the contract (integer(),time_unit() | 'native',time_unit() | 'native') -> integer() apps/explorer/lib/explorer/repo/prometheus_logger.ex:8: The call 'Elixir.System':convert_time_unit(__@1::any(),'native','microseconds') breaks the contract (integer(),time_unit() | 'native',time_unit() | 'native') -> integer()
apps/block_scout_web/lib/block_scout_web/views/layout_view.ex:175: The call 'Elixir.Poison.Parser':'parse!'(any(),#{'keys':='atoms!'}) will never return since the success typing is (binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []),[{atom(),_}]) -> 'false' | 'nil' | 'true' | binary() | ['false' | 'nil' | 'true' | binary() | [any()] | number() | map()] | number() | map() and the contract is (iodata(),'Elixir.Keyword':t()) -> t() lib/block_scout_web/views/layout_view.ex:172: The call 'Elixir.Poison.Parser':'parse!'(any(),#{'keys':='atoms!'}) will never return since the success typing is (binary() | maybe_improper_list(binary() | maybe_improper_list(any(),binary() | []) | byte(),binary() | []),[{atom(),_}]) -> 'false' | 'nil' | 'true' | binary() | ['false' | 'nil' | 'true' | binary() | [any()] | number() | map()] | number() | map() and the contract is (iodata(),'Elixir.Keyword':t()) -> t()
apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The pattern 'false' can never match the type 'true' apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The pattern 'false' can never match the type 'true'
apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The test 5 == 'infinity' can never evaluate to 'true' apps/explorer/lib/explorer/smart_contract/publisher_worker.ex:6: The test 5 == 'infinity' can never evaluate to 'true'
lib/block_scout_web/router.ex:1 lib/block_scout_web/router.ex:1
lib/phoenix/router.ex:324 lib/phoenix/router.ex:324
lib/block_scout_web/views/layout_view.ex:146 lib/block_scout_web/views/layout_view.ex:142

@ -38,10 +38,6 @@ defmodule BlockScoutWeb.LayoutView do
alias BlockScoutWeb.SocialMedia alias BlockScoutWeb.SocialMedia
def network_icon_partial do
Keyword.get(application_config(), :network_icon) || "_network_icon.html"
end
def logo do def logo do
Keyword.get(application_config(), :logo) || "/images/blockscout_logo.svg" Keyword.get(application_config(), :logo) || "/images/blockscout_logo.svg"
end end
@ -52,7 +48,7 @@ defmodule BlockScoutWeb.LayoutView do
end end
def subnetwork_title do def subnetwork_title do
Keyword.get(application_config(), :subnetwork) || "Sokol Testnet" Keyword.get(application_config(), :subnetwork) || "POA Sokol"
end end
def network_title do def network_title do

@ -13,18 +13,6 @@ defmodule BlockScoutWeb.LayoutViewTest do
end) end)
end end
describe "network_icon_partial/0" do
test "use the enviroment icon when it's configured" do
Application.put_env(:block_scout_web, BlockScoutWeb.Chain, network_icon: "custom_icon")
assert LayoutView.network_icon_partial() == "custom_icon"
end
test "use the default icon when there is no env configured for it" do
assert LayoutView.network_icon_partial() == "_network_icon.html"
end
end
describe "logo/0" do describe "logo/0" do
test "use the enviroment logo when it's configured" do test "use the enviroment logo when it's configured" do
Application.put_env(:block_scout_web, BlockScoutWeb.Chain, logo: "custom/logo.png") Application.put_env(:block_scout_web, BlockScoutWeb.Chain, logo: "custom/logo.png")
@ -45,7 +33,7 @@ defmodule BlockScoutWeb.LayoutViewTest do
end end
test "use the default subnetwork title when there is no env configured for it" do test "use the default subnetwork title when there is no env configured for it" do
assert LayoutView.subnetwork_title() == "Sokol Testnet" assert LayoutView.subnetwork_title() == "POA Sokol"
end end
end end
@ -119,11 +107,6 @@ defmodule BlockScoutWeb.LayoutViewTest do
url: "https://blockscout.com/rsk/mainnet", url: "https://blockscout.com/rsk/mainnet",
other?: true other?: true
}, },
%{
title: "POA Sokol",
url: "https://blockscout.com/poa/sokol",
test_net?: true
},
%{ %{
title: "LUKSO L14 testnet", title: "LUKSO L14 testnet",
url: "https://blockscout.com/lukso/l14", url: "https://blockscout.com/lukso/l14",
@ -157,11 +140,6 @@ defmodule BlockScoutWeb.LayoutViewTest do
Application.put_env(:block_scout_web, :other_networks, @supported_chains_pattern) Application.put_env(:block_scout_web, :other_networks, @supported_chains_pattern)
assert LayoutView.test_nets(LayoutView.other_networks()) == [ assert LayoutView.test_nets(LayoutView.other_networks()) == [
%{
title: "POA Sokol",
url: "https://blockscout.com/poa/sokol",
test_net?: true
},
%{ %{
title: "LUKSO L14 testnet", title: "LUKSO L14 testnet",
url: "https://blockscout.com/lukso/l14", url: "https://blockscout.com/lukso/l14",
@ -185,11 +163,6 @@ defmodule BlockScoutWeb.LayoutViewTest do
title: "RSK Mainnet", title: "RSK Mainnet",
url: "https://blockscout.com/rsk/mainnet", url: "https://blockscout.com/rsk/mainnet",
other?: true other?: true
},
%{
title: "POA Sokol",
url: "https://blockscout.com/poa/sokol",
test_net?: true
} }
] ]
end end

@ -45,7 +45,7 @@ config :explorer, Explorer.ChainSpec.GenesisData,
enabled: true, enabled: true,
chain_spec_path: System.get_env("CHAIN_SPEC_PATH"), chain_spec_path: System.get_env("CHAIN_SPEC_PATH"),
emission_format: System.get_env("EMISSION_FORMAT", "DEFAULT"), emission_format: System.get_env("EMISSION_FORMAT", "DEFAULT"),
rewards_contract_address: System.get_env("REWARDS_CONTRACT_ADDRESS", "0xeca443e8e1ab29971a45a9c57a6a9875701698a5") rewards_contract_address: System.get_env("REWARDS_CONTRACT", "0xeca443e8e1ab29971a45a9c57a6a9875701698a5")
config :explorer, Explorer.Chain.Cache.BlockNumber, config :explorer, Explorer.Chain.Cache.BlockNumber,
enabled: true, enabled: true,

Loading…
Cancel
Save