changed
hex_metadata.config
|
@@ -1,7 +1,7 @@
|
1
1
|
{<<"links">>,
|
2
2
|
[{<<"Source code">>,<<"https://github.com/electric-sql/phoenix_sync">>}]}.
|
3
3
|
{<<"name">>,<<"phoenix_sync">>}.
|
4
|
- {<<"version">>,<<"0.4.2">>}.
|
4
|
+ {<<"version">>,<<"0.4.3">>}.
|
5
5
|
{<<"description">>,
|
6
6
|
<<"Real-time sync for Postgres-backed Phoenix applications.">>}.
|
7
7
|
{<<"elixir">>,<<"~> 1.17">>}.
|
|
@@ -9,21 +9,22 @@
|
9
9
|
{<<"licenses">>,[<<"Apache-2.0">>]}.
|
10
10
|
{<<"files">>,
|
11
11
|
[<<"lib">>,<<"lib/phoenix">>,<<"lib/phoenix/sync">>,
|
12
|
- <<"lib/phoenix/sync/adapter">>,<<"lib/phoenix/sync/adapter/plug_api.ex">>,
|
13
12
|
<<"lib/phoenix/sync/plug">>,<<"lib/phoenix/sync/plug/utils.ex">>,
|
14
|
- <<"lib/phoenix/sync/gateway.ex">>,<<"lib/phoenix/sync/electric">>,
|
13
|
+ <<"lib/phoenix/sync/predefined_shape.ex">>,
|
14
|
+ <<"lib/phoenix/sync/adapter.ex">>,<<"lib/phoenix/sync/adapter">>,
|
15
|
+ <<"lib/phoenix/sync/adapter/plug_api.ex">>,
|
16
|
+ <<"lib/phoenix/sync/controller.ex">>,<<"lib/phoenix/sync/electric">>,
|
15
17
|
<<"lib/phoenix/sync/electric/client_adapter.ex">>,
|
16
|
- <<"lib/phoenix/sync/adapter.ex">>,
|
17
|
- <<"lib/phoenix/sync/predefined_shape.ex">>,<<"lib/phoenix/sync/plug.ex">>,
|
18
|
- <<"lib/phoenix/sync/writer">>,<<"lib/phoenix/sync/writer/format.ex">>,
|
18
|
+ <<"lib/phoenix/sync/gateway.ex">>,<<"lib/phoenix/sync/application.ex">>,
|
19
|
+ <<"lib/phoenix/sync/client.ex">>,<<"lib/phoenix/sync/live_view.ex">>,
|
20
|
+ <<"lib/phoenix/sync/plug.ex">>,<<"lib/phoenix/sync/router.ex">>,
|
21
|
+ <<"lib/phoenix/sync/writer.ex">>,<<"lib/phoenix/sync/writer">>,
|
22
|
+ <<"lib/phoenix/sync/writer/format.ex">>,
|
19
23
|
<<"lib/phoenix/sync/writer/format">>,
|
20
24
|
<<"lib/phoenix/sync/writer/format/tanstack_db.ex">>,
|
21
25
|
<<"lib/phoenix/sync/writer/operation.ex">>,
|
22
26
|
<<"lib/phoenix/sync/writer/transaction.ex">>,
|
23
|
- <<"lib/phoenix/sync/application.ex">>,<<"lib/phoenix/sync/controller.ex">>,
|
24
|
- <<"lib/phoenix/sync/client.ex">>,<<"lib/phoenix/sync/writer.ex">>,
|
25
|
- <<"lib/phoenix/sync/electric.ex">>,<<"lib/phoenix/sync/live_view.ex">>,
|
26
|
- <<"lib/phoenix/sync/router.ex">>,<<"lib/phoenix/sync.ex">>,
|
27
|
+ <<"lib/phoenix/sync/electric.ex">>,<<"lib/phoenix/sync.ex">>,
|
27
28
|
<<".formatter.exs">>,<<"mix.exs">>,<<"README.md">>,<<"LICENSE">>]}.
|
28
29
|
{<<"requirements">>,
|
29
30
|
[[{<<"name">>,<<"nimble_options">>},
|
|
@@ -54,7 +55,7 @@
|
54
55
|
[{<<"name">>,<<"electric">>},
|
55
56
|
{<<"app">>,<<"electric">>},
|
56
57
|
{<<"optional">>,true},
|
57
|
- {<<"requirement">>,<<"== 1.0.1">>},
|
58
|
+ {<<"requirement">>,<<"~> 1.0.6">>},
|
58
59
|
{<<"repository">>,<<"hexpm">>}],
|
59
60
|
[{<<"name">>,<<"electric_client">>},
|
60
61
|
{<<"app">>,<<"electric_client">>},
|
changed
lib/phoenix/sync/electric.ex
|
@@ -318,9 +318,7 @@ defmodule Phoenix.Sync.Electric do
|
318
318
|
|
319
319
|
if @electric_available? do
|
320
320
|
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.()
|
324
322
|
|
325
323
|
electric_config = core_configuration(env, db_config)
|
326
324
|
|
|
@@ -367,24 +365,6 @@ defmodule Phoenix.Sync.Electric do
|
367
365
|
opts
|
368
366
|
end
|
369
367
|
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
|
388
368
|
else
|
389
369
|
defp start_embedded(_env, _mode, _db_config_fun, _message) do
|
390
370
|
{:error,
|
changed
mix.exs
|
@@ -2,7 +2,7 @@ defmodule Phoenix.Sync.MixProject do
|
2
2
|
use Mix.Project
|
3
3
|
|
4
4
|
# Remember to update the README when you change the version
|
5
|
- @version "0.4.2"
|
5
|
+ @version "0.4.3"
|
6
6
|
|
7
7
|
def project do
|
8
8
|
[
|
|
@@ -18,7 +18,12 @@ defmodule Phoenix.Sync.MixProject do
|
18
18
|
package: package(),
|
19
19
|
description: description(),
|
20
20
|
source_url: "https://github.com/electric-sql/phoenix_sync",
|
21
|
- homepage_url: "https://hexdocs.pm/phoenix_sync"
|
21
|
+ homepage_url: "https://hexdocs.pm/phoenix_sync",
|
22
|
+ aliases: [
|
23
|
+ "test.all": ["test", "test.as_a_dep"],
|
24
|
+ "test.as_a_dep": &test_as_a_dep/1
|
25
|
+ ],
|
26
|
+ preferred_cli_env: ["test.all": :test]
|
22
27
|
]
|
23
28
|
end
|
24
29
|
|
|
@@ -36,9 +41,7 @@ defmodule Phoenix.Sync.MixProject do
|
36
41
|
{:plug, "~> 1.0"},
|
37
42
|
{:jason, "~> 1.0"},
|
38
43
|
{:ecto_sql, "~> 3.10", optional: true},
|
39
|
- # require an exact version because electric moves very quickly atm
|
40
|
- # and a more generous specification would inevitably break.
|
41
|
- {:electric, "== 1.0.1", optional: true},
|
44
|
+ {:electric, "~> 1.0.6", optional: true},
|
42
45
|
{:electric_client, ">= 0.5.0-beta-1"}
|
43
46
|
] ++ deps_for_env(Mix.env())
|
44
47
|
end
|
|
@@ -100,4 +103,36 @@ defmodule Phoenix.Sync.MixProject do
|
100
103
|
|
101
104
|
defp elixirc_paths(:test), do: ["lib", "test/support"]
|
102
105
|
defp elixirc_paths(_), do: ["lib"]
|
106
|
+
|
107
|
+ defp test_as_a_dep(args) do
|
108
|
+ IO.puts("==> Compiling ecto_sql from a dependency")
|
109
|
+ File.rm_rf!("tmp/as_a_dep")
|
110
|
+ File.mkdir_p!("tmp/as_a_dep")
|
111
|
+
|
112
|
+ File.cd!("tmp/as_a_dep", fn ->
|
113
|
+ File.write!("mix.exs", """
|
114
|
+ defmodule DepsOnPhoenixSync.MixProject do
|
115
|
+ use Mix.Project
|
116
|
+
|
117
|
+ def project do
|
118
|
+ [
|
119
|
+ app: :deps_on_ecto_sql,
|
120
|
+ version: "0.0.1",
|
121
|
+ deps: [{:phoenix_sync, path: "../.."}, {:electric, "~> 1.0"}]
|
122
|
+ ]
|
123
|
+ end
|
124
|
+ end
|
125
|
+ """)
|
126
|
+
|
127
|
+ mix_cmd_with_status_check(["do", "deps.get,", "compile", "--force" | args])
|
128
|
+ end)
|
129
|
+ end
|
130
|
+
|
131
|
+ defp mix_cmd_with_status_check(args, opts \\ []) do
|
132
|
+ {_, res} = System.cmd("mix", args, [into: IO.binstream(:stdio, :line)] ++ opts)
|
133
|
+
|
134
|
+ if res > 0 do
|
135
|
+ System.at_exit(fn _ -> exit({:shutdown, 1}) end)
|
136
|
+ end
|
137
|
+ end
|
103
138
|
end
|