File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
lib/plausible/data_migration Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,21 @@ defmodule Plausible.DataMigration.BackfillTeams do
1414 end
1515
1616 def run ( opts \\ [ ] ) do
17+ start_cloak ( )
18+
1719 dry_run? = Keyword . get ( opts , :dry_run? , true )
1820 Repo . transaction ( fn -> backfill ( dry_run? ) end , timeout: :infinity )
1921 end
2022
23+ defp start_cloak ( ) do
24+ Application . ensure_all_started ( :cloak )
25+ Application . ensure_all_started ( :cloak_ecto )
26+ Plausible.Auth.TOTP.Vault . start_link ( key: totp_vault_key ( ) )
27+ rescue
28+ _ ->
29+ :ok
30+ end
31+
2132 defp backfill ( dry_run? ) do
2233 # Orphaned teams
2334
@@ -613,4 +624,10 @@ defmodule Plausible.DataMigration.BackfillTeams do
613624 defp log ( msg ) do
614625 IO . puts ( "[#{ DateTime . utc_now ( :second ) } ] #{ msg } " )
615626 end
627+
628+ defp totp_vault_key ( ) do
629+ :plausible
630+ |> Application . fetch_env! ( Plausible.Auth.TOTP )
631+ |> Keyword . fetch! ( :vault_key )
632+ end
616633end
You can’t perform that action at this time.
0 commit comments