Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#9 Redact state of MainSocket from sensitive info #17

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading