File tree Expand file tree Collapse file tree
lib/plausible/data_migration Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,8 +14,15 @@ defmodule Plausible.DataMigration.BackfillTeams do
1414 end
1515
1616 def run ( opts \\ [ ] ) do
17- dry_run? = Keyword . get ( opts , :dry_run? , true )
18- Repo . transaction ( fn -> backfill ( dry_run? ) end , timeout: :infinity )
17+ Application . ensure_all_started ( :cloak )
18+ Application . ensure_all_started ( :cloak_ecto )
19+ Plausible.Auth.TOTP.Vault . start_link ( key: totp_vault_key ( ) )
20+ rescue
21+ _ ->
22+ :ok
23+
24+ dry_run? = Keyword . get ( opts , :dry_run? , true )
25+ Repo . transaction ( fn -> backfill ( dry_run? ) end , timeout: :infinity )
1926 end
2027
2128 defp backfill ( dry_run? ) do
@@ -613,4 +620,10 @@ defmodule Plausible.DataMigration.BackfillTeams do
613620 defp log ( msg ) do
614621 IO . puts ( "[#{ DateTime . utc_now ( :second ) } ] #{ msg } " )
615622 end
623+
624+ defp totp_vault_key ( ) do
625+ :plausible
626+ |> Application . fetch_env! ( Plausible.Auth.TOTP )
627+ |> Keyword . fetch! ( :vault_key )
628+ end
616629end
You can’t perform that action at this time.
0 commit comments