Skip to content

Commit

Permalink
Merge pull request #1597 from UrbanOS-Public/chris-ssl-test
Browse files Browse the repository at this point in the history
Trying a different format of retrieving the secure cookie env var
  • Loading branch information
c-m-duncan authored Jan 25, 2023
2 parents caff65d + 201ca3d commit 4512711
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions apps/andi/lib/andi/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ defmodule Andi.Application do
Application.put_env(:andi, :footer_left_side_text, get_footer_left_side_text())
Application.put_env(:andi, :footer_left_side_link, get_footer_left_side_link())
Application.put_env(:andi, :andi_footer_right_links, get_footer_right_links())
Application.put_env(:andi, :secure_cookie, get_secure_cookie())
end

def get_logo_url() do
Expand Down Expand Up @@ -175,6 +176,16 @@ defmodule Andi.Application do
get_env_variable("ANDI_FOOTER_RIGHT_LINKS", true)
end

def get_secure_cookie() do
var = get_env_variable("SECURE_COOKIE", false)

if var == nil do
false
else
var
end
end

defp guardian_db_sweeper do
Application.get_env(:andi, Guardian.DB)
|> case do
Expand Down
2 changes: 1 addition & 1 deletion apps/andi/lib/andi_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule AndiWeb.Endpoint do
@session_options [
store: :cookie,
key: "_andi_key",
secure: Application.get_env(:andi, AndiWeb.Endpoint)[:secure_cookie],
secure: Andi.Application.get_secure_cookie(),
signing_salt: "SekoFX7T"
]

Expand Down
2 changes: 1 addition & 1 deletion apps/andi/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Andi.MixProject do
def project do
[
app: :andi,
version: "2.5.49",
version: "2.5.50",
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand Down

0 comments on commit 4512711

Please sign in to comment.