File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
lib/mongoose_push/service Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ defmodule MongoosePush.Service.APNS do
7474 :dev -> :development_endpoint
7575 :prod -> :production_endpoint
7676 end
77- Enum . into ( [ { new_key , config [ :endpoint ] } ] , config )
77+ Keyword . merge ( [ { new_key , config [ :endpoint ] } ] , config )
7878 end
7979
8080 defp announce_subject ( config ) do
@@ -101,7 +101,7 @@ defmodule MongoosePush.Service.APNS do
101101 all_topics = Certificate . extract_topics! ( config [ :cert ] )
102102 default_topic = all_topics [ :topic ]
103103 Logger . info ( ~s" Successfully extracted default APNS topic: #{ default_topic } " )
104- Enum . into ( [ default_topic: default_topic ] , config )
104+ Keyword . merge ( [ default_topic: default_topic ] , config )
105105 default_topic ->
106106 Logger . info ( ~s" Using user-defined default APNS topic: #{ default_topic } " )
107107 config
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ defmodule MongoosePush.Service.FCM do
5353 @ spec workers ( { atom , Keyword . t ( ) } | nil ) :: list ( Supervisor.Spec . spec ( ) )
5454 def workers ( nil ) , do: [ ]
5555 def workers ( { pool_name , pool_config } ) do
56- Logger . info ~s" Starting FCM pool with API key #{ pool_config [ :key ] } "
56+ Logger . info ~s" Starting FCM pool with API key #{ filter_secret ( pool_config [ :key ] ) } "
5757 pool_size = pool_config [ :pool_size ]
5858 Enum . map ( 1 .. pool_size , fn ( id ) ->
5959 worker_name = Pools . worker_name ( :fcm , pool_name , id )
@@ -62,4 +62,15 @@ defmodule MongoosePush.Service.FCM do
6262 end )
6363 end
6464
65+ defp filter_secret ( secret ) when is_binary ( secret ) do
66+ prefix = String . slice ( secret , 0 .. 2 )
67+ suffix =
68+ secret
69+ |> String . slice ( 3 .. - 1 )
70+ |> String . slice ( - 3 .. - 1 )
71+
72+ prefix <> "*******" <> suffix
73+ end
74+ defp filter_secret ( secret ) , do: secret
75+
6576end
You can’t perform that action at this time.
0 commit comments