Skip to content

Commit

Permalink
use compile_env
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyshull committed Jan 18, 2024
1 parent 338c296 commit 94217fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/cms/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ defmodule CMS.Repo do

alias Routes.Route

@cache Application.get_env(:dotcom, :cms_cache)
@cache Application.compile_env!(:dotcom, :cms_cache)

@cms_api Application.get_env(:dotcom, :cms_api)
@cms_api Application.compile_env!(:dotcom, :cms_api)

@ttl :timer.hours(1)

Expand Down Expand Up @@ -394,7 +394,6 @@ defmodule CMS.Repo do
Paragraphs are stand-alone partials from the CMS. Supports redirects.
"""
@spec get_paragraph(String.t(), map) :: Paragraph.t() | {:error, any()}
@decorate cacheable(cache: @cache, on_error: :nothing, opts: [ttl: @ttl])
def get_paragraph(path, query_params \\ %{}) do
case view_or_preview(path, query_params) do
{:ok, api_data} ->
Expand All @@ -410,7 +409,6 @@ defmodule CMS.Repo do

@doc "Get all the events, paginating through results if needed, and caches the result"
@spec events_for_year(Calendar.year()) :: [%Teaser{}]
@decorate cacheable(cache: @cache, on_error: :nothing, opts: [ttl: @ttl])
def events_for_year(year) do
do_events_for_range(
min: Timex.beginning_of_year(year) |> Util.convert_to_iso_format(),
Expand Down
2 changes: 1 addition & 1 deletion lib/dotcom_web/controllers/cms_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ defmodule DotcomWeb.CMSController do
Page.ProjectUpdate
]

@cache Application.get_env(:dotcom, :cms_cache)
@cache Application.compile_env!(:dotcom, :cms_cache)

@spec page(Conn.t(), map) :: Conn.t()
def page(%Conn{request_path: path, query_params: query_params} = conn, _params) do
Expand Down

0 comments on commit 94217fd

Please sign in to comment.