From 1fc0e6f311f1620960b92bed2ab79d51fedbf339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Lobo?= Date: Sat, 4 Nov 2023 21:38:44 +0000 Subject: [PATCH] fix: fetch wheel price from .env at compile time --- lib/safira_web/controllers/roulette_controller.ex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/safira_web/controllers/roulette_controller.ex b/lib/safira_web/controllers/roulette_controller.ex index 11feb635..8c12d4ae 100644 --- a/lib/safira_web/controllers/roulette_controller.ex +++ b/lib/safira_web/controllers/roulette_controller.ex @@ -6,6 +6,8 @@ defmodule SafiraWeb.RouletteController do action_fallback SafiraWeb.FallbackController + @price Application.compile_env!(:safira, :roulette_cost) + def spin(conn, _params) do attendee = Accounts.get_user(conn) |> Map.fetch!(:attendee) @@ -32,7 +34,6 @@ defmodule SafiraWeb.RouletteController do end def price(conn, _params) do - price = Application.fetch_env!(:safira, :roulette_cost) - render(conn, "price.json", price: price) + render(conn, "price.json", price: @price) end end