diff --git a/README.md b/README.md index fa18f46947..cab4e09b19 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ This is a tool for inspecting and analyzing the POA Network blockchain. To get POA Explorer up and running locally: + * Set up some default configuration with: `$ cp config/dev.secrets.esx.example config/dev.secrets.esx` * Install dependencies with `$ mix do deps.get, local.rebar, deps.compile, compile` * Create and migrate your database with `$ mix ecto.create && mix ecto.migrate` * Install Node.js dependencies with `$ cd assets && npm install && cd ..` diff --git a/config/config.exs b/config/config.exs index 1697693cbe..17ce79a7d7 100644 --- a/config/config.exs +++ b/config/config.exs @@ -15,7 +15,6 @@ config :explorer, ExplorerWeb.Gettext, locales: ~w(en), default_locale: "en" # Configures the endpoint config :explorer, ExplorerWeb.Endpoint, url: [host: "localhost"], - secret_key_base: "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5", render_errors: [view: ExplorerWeb.ErrorView, accepts: ~w(html json)], pubsub: [name: Explorer.PubSub, adapter: Phoenix.PubSub.PG2] @@ -24,11 +23,11 @@ config :logger, :console, format: "$time $metadata[$level] $message\n", metadata: [:request_id] +config :ethereumex, + scheme: "http", + host: "localhost", + port: 8545 + # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. import_config "#{Mix.env}.exs" - -config :ethereumex, - scheme: "https", - host: "sokol.poa.network", - port: 443 diff --git a/config/dev.exs b/config/dev.exs index 7ab30a26bf..1e6b2f23b6 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -54,3 +54,5 @@ config :explorer, Explorer.Repo, database: "explorer_dev", hostname: "localhost", pool_size: 10 + +import_config "dev.secret.exs" diff --git a/config/dev.secret.exs.example b/config/dev.secret.exs.example new file mode 100644 index 0000000000..160ca4b571 --- /dev/null +++ b/config/dev.secret.exs.example @@ -0,0 +1,11 @@ +use Mix.Config + +# Configure ethereumex +config :ethereumex, + scheme: "http", + host: "localhost", + port: 8545 + +# Configures the endpoint +config :explorer, ExplorerWeb.Endpoint, + secret_key_base: "RMgI4C1HSkxsEjdhtGMfwAHfyT6CKWXOgzCboJflfSm4jeAlic52io05KB6mqzc5" diff --git a/config/prod.exs b/config/prod.exs index 88cc06ad5c..61da3fb889 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -35,3 +35,8 @@ config :explorer, Explorer.Repo, config :new_relixir, application_name: System.get_env("NEW_RELIC_APP_NAME"), license_key: System.get_env("NEW_RELIC_LICENSE_KEY") + +config :ethereumex, + scheme: System.get_env("ETHEREUM_SCHEME"), + host: System.get_env("ETHEREUM_HOST"), + port: System.get_env("ETHEREUM_PORT") diff --git a/config/test.exs b/config/test.exs index 0b76c4ca1d..7112416a1c 100644 --- a/config/test.exs +++ b/config/test.exs @@ -4,6 +4,7 @@ use Mix.Config # you can enable the server option below. config :explorer, ExplorerWeb.Endpoint, http: [port: 4001], + secret_key_base: "27Swe6KtEtmN37WyEYRjKWyxYULNtrxlkCEKur4qoV+Lwtk8lafsR16ifz1XBBYj", server: true config :explorer, :sql_sandbox, true @@ -18,6 +19,13 @@ config :explorer, Explorer.Repo, hostname: "localhost", pool: Ecto.Adapters.SQL.Sandbox +# Configure wallaby config :wallaby, screenshot_on_failure: true, chrome: [headless: false] + +# Configure ethereumex +config :ethereumex, + scheme: "https", + host: "sokol.poa.network", + port: 443 diff --git a/mix.exs b/mix.exs index e138485507..84a0292256 100644 --- a/mix.exs +++ b/mix.exs @@ -25,12 +25,14 @@ defmodule Explorer.Mixfile do end # Specifies which paths to compile per environment. - defp elixirc_paths(:test), do: ["lib", "test/support"] - defp elixirc_paths(_), do: ["lib"] + defp elixirc_paths(:test), do: ["test/support" | elixirc_paths()] + defp elixirc_paths(_), do: elixirc_paths() + defp elixirc_paths, do: ["lib"] # Specifies extra applications to start per environment - defp extra_applications(:prod), do: [:ethereumex, :timex, :timex_ecto, :set_locale, :logger, :runtime_tools, :phoenix_pubsub_redis, :new_relixir] - defp extra_applications(_), do: [:ethereumex, :timex, :timex_ecto, :set_locale, :logger, :runtime_tools] + defp extra_applications(:prod), do: [:phoenix_pubsub_redis, :new_relixir | extra_applications()] + defp extra_applications(_), do: extra_applications() + defp extra_applications, do: [:ethereumex, :timex, :timex_ecto, :set_locale, :logger, :runtime_tools] # Specifies your project dependencies. #