Update script to rotate global relays token

This commit is contained in:
Andrew Dryga
2024-01-16 19:09:25 -06:00
parent ba470c22ca
commit 2e92174697
2 changed files with 6 additions and 2 deletions

View File

@@ -370,10 +370,10 @@ iex(web@web-2f4j.us-east1-d.c.firezone-staging.internal)7> {:ok, subject} = Doma
```elixir
iex(web@web-xxxx.us-east1-d.c.firezone-staging.internal)1> # select group to update
iex(web@web-xxxx.us-east1-d.c.firezone-staging.internal)1> group = Domain.Repo.one!(Domain.Relays.Group.Query.global())
...
iex(web@web-xxxx.us-east1-d.c.firezone-staging.internal)2> {:ok, token} = Domain.Relays.create_token(group, %{}, subject)
iex(web@web-xxxx.us-east1-d.c.firezone-staging.internal)2> {:ok, token} = Domain.Relays.create_token(group, %{})
...
```

View File

@@ -18,6 +18,10 @@ defmodule Domain.Relays.Group.Query do
where(queryable, [groups: groups], groups.account_id == ^account_id)
end
def global(queryable \\ not_deleted()) do
where(queryable, [groups: groups], is_nil(groups.account_id))
end
def global_or_by_account_id(queryable \\ not_deleted(), account_id) do
where(
queryable,