diff --git a/config/staging.exs b/config/staging.exs new file mode 100644 index 0000000..eddb7e1 --- /dev/null +++ b/config/staging.exs @@ -0,0 +1,6 @@ +use Mix.Config + +# Any custom change to be tested in a production like environment must be added here +import_config "prod.exs" + +config :elixir_bench, ElixirBenchWeb.Endpoint, origins: [~r/tallysmartins.github.io$/] diff --git a/lib/elixir_bench_web/endpoint.ex b/lib/elixir_bench_web/endpoint.ex index 01bcb3e..07e1d6d 100644 --- a/lib/elixir_bench_web/endpoint.ex +++ b/lib/elixir_bench_web/endpoint.ex @@ -28,9 +28,14 @@ defmodule ElixirBenchWeb.Endpoint do plug Plug.MethodOverride plug Plug.Head + allowed_origins = + :elixir_bench + |> Application.get_env(ElixirBenchWeb.Endpoint, []) + |> Keyword.get(:origins, []) + plug Corsica, max_age: 600, - origins: [~r/localhost:\d+$/, ~r/elixirbench.org$/], + origins: [~r/localhost:\d+$/, ~r/elixirbench.org$/] ++ allowed_origins, allow_headers: ~w(accept content-type origin) plug ElixirBenchWeb.Router diff --git a/mix.exs b/mix.exs index 8309502..bf6a269 100644 --- a/mix.exs +++ b/mix.exs @@ -8,7 +8,7 @@ defmodule ElixirBench.Mixfile do elixir: "~> 1.4", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix] ++ Mix.compilers(), - start_permanent: Mix.env() == :prod, + start_permanent: Mix.env() == :prod || Mix.env() == :staging, aliases: aliases(), test_coverage: [tool: ExCoveralls], preferred_cli_env: [ diff --git a/rel/config.exs b/rel/config.exs index 298db19..f131380 100644 --- a/rel/config.exs +++ b/rel/config.exs @@ -39,6 +39,11 @@ environment :prod do set cookie: :"?HJ`Ukk;))_nwy4>j>@bPXc6oNSZ==ivI9kF96,63D)S]lkI~tT^NJL]TN@Or5*4" end +environment :staging do + set include_erts: true + set include_src: false +end + # You may define one or more releases in this file. # If you have not set a default release, or selected one # when running `mix release`, the first release in the file