simpleshop_printify/lib/simpleshop/printify/token_store.ex

25 lines
641 B
Elixir
Raw Normal View History

2025-11-30 11:05:49 +00:00
defmodule Simpleshop.Printify.TokenStore do
@moduledoc """
Simple module to retrieve the Printify Personal Access Token from config.
No GenServer or ETS needed - just reads from application config.
"""
def get_access_token do
config = Application.get_env(:simpleshop, :printify)
case Keyword.get(config, :access_token) do
nil -> {:error, :not_configured}
"" -> {:error, :not_configured}
"your_personal_access_token_here" -> {:error, :not_configured}
token -> {:ok, token}
end
end
def has_tokens? do
case get_access_token() do
{:ok, _} -> true
_ -> false
end
end
end