Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds tallysmartins to cors origins #40

Merged
merged 2 commits into from Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions 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$/]
7 changes: 6 additions & 1 deletion lib/elixir_bench_web/endpoint.ex
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Expand Up @@ -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: [
Expand Down
5 changes: 5 additions & 0 deletions rel/config.exs
Expand Up @@ -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
Expand Down