Skip to content

Commit

Permalink
Merge pull request #17 from dsienkiewicz/9-redact-sensitive-data-on-s…
Browse files Browse the repository at this point in the history
…ockets

#9 Redact state of MainSocket from sensitive info
  • Loading branch information
dsienkiewicz authored Dec 5, 2023
2 parents 4f19351 + add0009 commit f5e4754
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ params = [
app_name: "XtbClient",
type: :demo,
url: "wss://ws.xtb.com",
user: "<<USER_ID>>",
password: "<<PASSWORD>>"}
user: username,
password: password}
]

{:ok, pid} = XtbClient.Connection.start_link(params)
Expand All @@ -46,8 +46,8 @@ params = [
app_name: "XtbClient",
type: :demo,
url: "wss://ws.xtb.com",
user: "<<USER_ID>>",
password: "<<PASSWORD>>"}
user: username,
password: password}
]
{:ok, cpid} = XtbClient.Connection.start_link(params)

Expand Down Expand Up @@ -100,8 +100,8 @@ params = [
app_name: "XtbClient",
type: :demo,
url: "wss://ws.xtb.com",
user: "<<USER_ID>>",
password: "<<PASSWORD>>"}
user: username,
password: password}
]
{:ok, cpid} = XtbClient.Connection.start_link(params)

Expand Down
18 changes: 18 additions & 0 deletions lib/xtb_client/main_socket.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ defmodule XtbClient.MainSocket do
stream_session_id: nil,
queries: %{},
rate_limit: nil

defimpl Inspect do
def inspect(state, opts) do
Inspect.Map.inspect(
%{
url: state.url,
account_type: state.account_type,
user: "<<REDACTED>>",
password: "<<REDACTED>>",
app_name: state.app_name,
stream_session_id: state.stream_session_id,
queries: state.queries,
rate_limit: state.rate_limit
},
opts
)
end
end
end

@doc """
Expand Down

0 comments on commit f5e4754

Please sign in to comment.