Skip to content

Commit

Permalink
Merge branch 'master' into rs/log_datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
rslota authored Jun 24, 2019
2 parents c9c47c3 + 3fed48c commit b9f5213
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/mongoose_push/service/fcm.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ defmodule MongoosePush.Service.FCM do
@spec workers({atom, Keyword.t()} | nil) :: list(Supervisor.Spec.spec())
def workers(nil), do: []
def workers({pool_name, pool_config}) do
Logger.info ~s"Starting FCM pool with API key #{pool_config[:key]}"
Logger.info ~s"Starting FCM pool with API key #{filter_secret(pool_config[:key])}"
pool_size = pool_config[:pool_size]
Enum.map(1..pool_size, fn(id) ->
worker_name = Pools.worker_name(:fcm, pool_name, id)
Expand All @@ -62,4 +62,15 @@ defmodule MongoosePush.Service.FCM do
end)
end

defp filter_secret(secret) when is_binary(secret) do
prefix = String.slice(secret, 0..2)
suffix =
secret
|> String.slice(3..-1)
|> String.slice(-3..-1)

prefix <> "*******" <> suffix
end
defp filter_secret(secret), do: secret

end

0 comments on commit b9f5213

Please sign in to comment.