aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/oauth/token.ex
diff options
context:
space:
mode:
authorAlexander Strizhakov <alex.strizhakov@gmail.com>2019-06-14 15:45:05 +0000
committerkaniini <nenolod@gmail.com>2019-06-14 15:45:05 +0000
commitc2ca1f22a25d22d6d863406ed05b08c643e5824c (patch)
treebf75fc306788d784d74fb6ca617f3ddd27b75fd2 /lib/pleroma/web/oauth/token.ex
parentb7fc722a2e9e93341229cb122aac605421782295 (diff)
downloadpleroma-c2ca1f22a25d22d6d863406ed05b08c643e5824c.tar.gz
it is changed in compile time
we can't change module attributes and endpoint settings in runtime
Diffstat (limited to 'lib/pleroma/web/oauth/token.ex')
-rw-r--r--lib/pleroma/web/oauth/token.ex5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/pleroma/web/oauth/token.ex b/lib/pleroma/web/oauth/token.ex
index f412f7eb2..90c304487 100644
--- a/lib/pleroma/web/oauth/token.ex
+++ b/lib/pleroma/web/oauth/token.ex
@@ -14,7 +14,6 @@ defmodule Pleroma.Web.OAuth.Token do
alias Pleroma.Web.OAuth.Token
alias Pleroma.Web.OAuth.Token.Query
- @expires_in Pleroma.Config.get([:oauth2, :token_expires_in], 600)
@type t :: %__MODULE__{}
schema "oauth_tokens" do
@@ -78,7 +77,7 @@ defmodule Pleroma.Web.OAuth.Token do
defp put_valid_until(changeset, attrs) do
expires_in =
- Map.get(attrs, :valid_until, NaiveDateTime.add(NaiveDateTime.utc_now(), @expires_in))
+ Map.get(attrs, :valid_until, NaiveDateTime.add(NaiveDateTime.utc_now(), expires_in()))
changeset
|> change(%{valid_until: expires_in})
@@ -123,4 +122,6 @@ defmodule Pleroma.Web.OAuth.Token do
end
def is_expired?(_), do: false
+
+ defp expires_in, do: Pleroma.Config.get([:oauth2, :token_expires_in], 600)
end