From 283a749fbaaab03cf582e2afb6c9ff999c155935 Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Wed, 27 Mar 2024 08:31:06 -0700 Subject: [PATCH] Updated env var --- config/config.exs | 2 +- config/runtime.exs | 4 ++-- lib/pinchflat_web/router.ex | 2 +- test/pinchflat_web/routing_test.exs | 14 +++++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/config.exs b/config/config.exs index 5038e77..4c26b3b 100644 --- a/config/config.exs +++ b/config/config.exs @@ -22,7 +22,7 @@ config :pinchflat, # If either is unset, basic auth will not be used. basic_auth_username: "", basic_auth_password: "", - expose_xml_feed: false, + expose_feed_endpoints: false, file_watcher_poll_interval: 1000 # Configures the endpoint diff --git a/config/runtime.exs b/config/runtime.exs index f494884..1f4150e 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -48,7 +48,7 @@ if config_env() == :prod do extras_path = System.get_env("EXTRAS_PATH", Path.join([config_path, "extras"])) # For running PF as a podcast host on self-hosted environments - expose_xml_feed = String.length(System.get_env("EXPOSE_XML_FEED", "")) > 0 + expose_feed_endpoints = String.length(System.get_env("EXPOSE_FEED_ENDPOINTS", "")) > 0 # We want to force _some_ level of useful logging in production acceptable_log_levels = ~w(debug info)a @@ -68,7 +68,7 @@ if config_env() == :prod do extras_directory: extras_path, tmpfile_directory: Path.join([System.tmp_dir!(), "pinchflat", "data"]), dns_cluster_query: System.get_env("DNS_CLUSTER_QUERY"), - expose_xml_feed: expose_xml_feed + expose_feed_endpoints: expose_feed_endpoints config :pinchflat, Pinchflat.Repo, database: db_path, diff --git a/lib/pinchflat_web/router.ex b/lib/pinchflat_web/router.ex index 68d3091..6b70d03 100644 --- a/lib/pinchflat_web/router.ex +++ b/lib/pinchflat_web/router.ex @@ -63,7 +63,7 @@ defmodule PinchflatWeb.Router do end defp maybe_basic_auth(conn, opts) do - if Application.get_env(:pinchflat, :expose_xml_feed) do + if Application.get_env(:pinchflat, :expose_feed_endpoints) do conn else basic_auth(conn, opts) diff --git a/test/pinchflat_web/routing_test.exs b/test/pinchflat_web/routing_test.exs index 42d4e31..cbe4dd8 100644 --- a/test/pinchflat_web/routing_test.exs +++ b/test/pinchflat_web/routing_test.exs @@ -61,23 +61,23 @@ defmodule PinchflatWeb.RoutingTest do setup do old_username = Application.get_env(:pinchflat, :basic_auth_username) old_password = Application.get_env(:pinchflat, :basic_auth_password) - old_expore_xml_feed = Application.get_env(:pinchflat, :expose_xml_feed) + old_expose_feed_endpoints = Application.get_env(:pinchflat, :expose_feed_endpoints) source = source_fixture() on_exit(fn -> Application.put_env(:pinchflat, :basic_auth_username, old_username) Application.put_env(:pinchflat, :basic_auth_password, old_password) - Application.put_env(:pinchflat, :expose_xml_feed, old_expore_xml_feed) + Application.put_env(:pinchflat, :expose_feed_endpoints, old_expose_feed_endpoints) end) {:ok, source: source} end - test "uses basic auth when expose_xml_feed is false", %{source: source} do + test "uses basic auth when expose_feed_endpoints is false", %{source: source} do Application.put_env(:pinchflat, :basic_auth_username, "user") Application.put_env(:pinchflat, :basic_auth_password, "pass") - Application.put_env(:pinchflat, :expose_xml_feed, false) + Application.put_env(:pinchflat, :expose_feed_endpoints, false) conn = get(build_conn(), "/sources/#{source.uuid}/feed") @@ -85,10 +85,10 @@ defmodule PinchflatWeb.RoutingTest do assert {"www-authenticate", "Basic realm=\"Pinchflat\""} in conn.resp_headers end - test "does not use basic auth when expose_xml_feed is true", %{source: source} do + test "does not use basic auth when expose_feed_endpoints is true", %{source: source} do Application.put_env(:pinchflat, :basic_auth_username, "user") Application.put_env(:pinchflat, :basic_auth_password, "pass") - Application.put_env(:pinchflat, :expose_xml_feed, true) + Application.put_env(:pinchflat, :expose_feed_endpoints, true) conn = get(build_conn(), "/sources/#{source.uuid}/feed") @@ -98,7 +98,7 @@ defmodule PinchflatWeb.RoutingTest do test "does not use basic auth when username/password aren't set", %{source: source} do Application.put_env(:pinchflat, :basic_auth_username, nil) Application.put_env(:pinchflat, :basic_auth_password, nil) - Application.put_env(:pinchflat, :expose_xml_feed, false) + Application.put_env(:pinchflat, :expose_feed_endpoints, false) conn = get(build_conn(), "/sources/#{source.uuid}/feed")