Content-Length: 453983 | pFad | http://github.com/electric-sql/phoenix_sync/commit/93385cf329886a8779f5fb7a16bf4140f46f62be

41 remove password obfuscation · electric-sql/phoenix_sync@93385cf · GitHub
Skip to content

Commit 93385cf

Browse files
committed
remove password obfuscation
now handled by electric automatically replaces #23
1 parent 6753135 commit 93385cf

File tree

3 files changed

+6
-35
lines changed

3 files changed

+6
-35
lines changed

config/runtime.exs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ if config_env() == :test do
55
default_database_url = "postgresql://postgres:password@localhost:54321/electric?sslmode=disable"
66
database_url = System.get_env("DATABASE_URL", default_database_url)
77

8-
connection_opts = Electric.Config.parse_postgresql_uri!(database_url)
9-
108
config :electric,
119
start_in_library_mode: true,
12-
connection_opts: Electric.Utils.obfuscate_password(connection_opts),
10+
connection_opts: Electric.Config.parse_postgresql_uri!(database_url),
1311
# enable the http api so that the client tests against a real endpoint can
1412
# run against our embedded electric instance.
1513
# enable_http_api: true,

lib/phoenix/sync/electric.ex

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,7 @@ defmodule Phoenix.Sync.Electric do
318318

319319
if @electric_available? do
320320
defp start_embedded(env, mode, db_config_fun, message) do
321-
db_config =
322-
db_config_fun.()
323-
|> obfuscate_credentials()
321+
db_config = db_config_fun.()
324322

325323
electric_config = core_configuration(env, db_config)
326324

@@ -367,24 +365,6 @@ defmodule Phoenix.Sync.Electric do
367365
opts
368366
end
369367
end
370-
371-
defp obfuscate_credentials(opts) do
372-
opts
373-
|> Keyword.update!(:replication_connection_opts, &Electric.Utils.obfuscate_password/1)
374-
|> then(fn opts ->
375-
case Keyword.fetch(opts, :query_connection_opts) do
376-
:error ->
377-
opts
378-
379-
{:ok, query_connection_opts} ->
380-
Keyword.put(
381-
opts,
382-
:query_connection_opts,
383-
Electric.Utils.obfuscate_password(query_connection_opts)
384-
)
385-
end
386-
end)
387-
end
388368
else
389369
defp start_embedded(_env, _mode, _db_config_fun, _message) do
390370
{:error,

test/phoenix/sync/application_test.exs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ defmodule Phoenix.Sync.ApplicationTest do
1010
get_in(opts, [:replication_opts, :connection_opts]) || [],
1111
opts[:connection_opts]
1212
] do
13-
assert {pass_fun, connection_opts} =
13+
assert {"password", connection_opts} =
1414
Keyword.pop!(connection_opts, :password)
1515

16-
assert pass_fun.() == "password"
17-
1816
base_opts = [
1917
username: "postgres",
2018
hostname: "localhost",
@@ -213,22 +211,18 @@ defmodule Phoenix.Sync.ApplicationTest do
213211

214212
assert {:ok, [{Electric.StackSupervisor, opts}]} = App.children(config)
215213

216-
assert {pass_fun, connection_opts} =
214+
assert {"password", connection_opts} =
217215
Keyword.pop!(opts[:replication_opts][:connection_opts], :password)
218216

219-
assert pass_fun.() == "password"
220-
221217
assert connection_opts == [
222218
username: "postgres",
223219
hostname: "localhost",
224220
database: "electric"
225221
]
226222

227-
assert {pass_fun, connection_opts} =
223+
assert {"password", connection_opts} =
228224
Keyword.pop!(opts[:connection_opts], :password)
229225

230-
assert pass_fun.() == "password"
231-
232226
assert connection_opts == [
233227
username: "postgres",
234228
hostname: "localhost-pooled",
@@ -258,8 +252,7 @@ defmodule Phoenix.Sync.ApplicationTest do
258252

259253
assert {:ok, [{Electric.StackSupervisor, opts}]} = App.children(config)
260254

261-
assert {pass_fun, connection_opts} = Keyword.pop!(opts[:connection_opts], :password)
262-
assert pass_fun.() == "password"
255+
assert {"password", connection_opts} = Keyword.pop!(opts[:connection_opts], :password)
263256

264257
assert connection_opts == [
265258
username: "postgres",

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/electric-sql/phoenix_sync/commit/93385cf329886a8779f5fb7a16bf4140f46f62be

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy