Skip to content

Commit

Permalink
fix(force_ssl): Configure force_ssl in prod instead of runtime (#2035)
Browse files Browse the repository at this point in the history
* fix(force_ssl): Configure force_ssl in prod instead of runtime

* Removed unless check

* Moved config to test
  • Loading branch information
kotva006 authored May 8, 2024
1 parent fd9adcd commit b418fc8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
9 changes: 0 additions & 9 deletions config/deps/phoenix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,3 @@ else
# and calculating stacktraces is usually expensive.
config :phoenix, :stacktrace_depth, 20
end

if config_env() == :test do
# Let test requests get routed through the :secure pipeline
config :dotcom, :secure_pipeline,
force_ssl: [
host: nil,
rewrite_on: [:x_forwarded_proto]
]
end
8 changes: 8 additions & 0 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@ import Config

config :dotcom, :cache, Dotcom.Cache.Multilevel
config :dotcom, :trip_plan_feedback_cache, Dotcom.Cache.TripPlanFeedback.Cache

# configured separately so that we can have the health check not require
# SSL
config :dotcom, :secure_pipeline,
force_ssl: [
host: nil,
rewrite_on: [:x_forwarded_proto]
]
10 changes: 0 additions & 10 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,6 @@ if config_env() == :prod do
port: System.get_env("STATIC_PORT")
]

unless System.get_env("PORT") do
# configured separately so that we can have the health check not require
# SSL
config :dotcom, :secure_pipeline,
force_ssl: [
host: nil,
rewrite_on: [:x_forwarded_proto]
]
end

config :dotcom,
support_ticket_to_email: System.get_env("SUPPORT_TICKET_TO_EMAIL"),
support_ticket_from_email: System.get_env("SUPPORT_TICKET_FROM_EMAIL"),
Expand Down
7 changes: 7 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ config :dotcom, :redix_pub_sub, Dotcom.Redix.PubSub.Mock
config :dotcom, :req_module, Req.Mock

config :dotcom, :trip_plan_feedback_cache, Dotcom.Cache.TestCache

# Let test requests get routed through the :secure pipeline
config :dotcom, :secure_pipeline,
force_ssl: [
host: nil,
rewrite_on: [:x_forwarded_proto]
]

0 comments on commit b418fc8

Please sign in to comment.