shift73k/lib/shift73k.ex

39 lines
1.3 KiB
Elixir

defmodule Shift73k do
@moduledoc """
Shift73k keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
@weekdays [:monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday]
defp get_app_config_env do
Application.get_env(:shift73k, :app_global_vars,
time_zone: "America/New_York",
allow_registration: :true,
mailer_reply_to: "admin@example.com",
mailer_from: {"Shift73k", "shift73k@example.com"}
)
end
def weekdays, do: @weekdays
def get_app_time_zone, do:
get_app_config_env() |> Keyword.fetch!(:time_zone) |> IO.inspect(label: "time_zone", pretty: :true)
def get_app_mailer_from, do:
get_app_config_env() |> Keyword.fetch!(:mailer_from) |> IO.inspect(label: "mailer_from", pretty: :true)
def get_app_mailer_reply_to, do:
get_app_config_env() |> Keyword.fetch!(:mailer_reply_to) |> IO.inspect(label: "mailer_reply_to", pretty: :true)
def get_app_allow_reg, do:
get_app_config_env() |> Keyword.fetch!(:allow_registration) |> get_app_allow_reg()
|> IO.inspect(label: "allow_registration", pretty: :true)
def get_app_allow_reg("false"), do: :false
def get_app_allow_reg(:false), do: :false
def get_app_allow_reg(_not_false), do: :true
end