25 lines
641 B
Elixir
25 lines
641 B
Elixir
|
|
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
|