Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: rename garden boruta_client_id to oauth_client_id

+20 -17
+6 -3
.envrc
··· 9 9 if [ -z "$2" ]; then 10 10 dd if=/dev/urandom bs=1 count=64 | hexdump -e '64/1 "%02x"' >"$SECRET" 11 11 else 12 - eval $2 >"$SECRET" 12 + eval "$2" >"$SECRET" 13 13 fi 14 14 fi 15 15 } ··· 26 26 genSecret "$PWD/.dev-login-token" 27 27 SOWER_DEV_LOGIN_TOKEN=$(cat "$PWD/.dev-login-token") 28 28 export SOWER_DEV_LOGIN_TOKEN 29 - genSecret "$PWD/.dev-cloak-ecto" $PWD/bin/gen-cloak-key.exs 29 + genSecret "$PWD/.dev-cloak-ecto" "$PWD/bin/gen-cloak-key.exs" 30 30 31 31 # shellcheck disable=SC2089 32 32 ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_file_bytes 1024000 -kernel shell_history_path '\"$PWD/.erlang-history\"'" 33 - # # shellcheck disable=SC2090 33 + # shellcheck disable=SC2090 34 34 export ERL_AFLAGS 35 35 36 36 export MIX_OS_DEPS_COMPILE_PARTITION_COUNT=$(($(nproc) / 2)) 37 37 38 38 export PGDATA="$PWD/.services/postgres/data" 39 + export PGDATABASE=sower_dev 40 + export PGHOST="$PGDATA" 41 + export PGUSER=postgres 39 42 export PC_CONFIG_FILES="$PWD/.services/process-compose/process-compose.yaml" 40 43 41 44 export GOCACHE="$PWD/.gocache"
+2 -2
apps/sower/lib/sower/garden_auth.ex
··· 31 31 }) 32 32 end 33 33 34 - def delete_client(boruta_client_id) do 35 - client = Boruta.Ecto.Admin.get_client!(boruta_client_id) 34 + def delete_client(oauth_client_id) do 35 + client = Boruta.Ecto.Admin.get_client!(oauth_client_id) 36 36 Boruta.Ecto.Admin.delete_client(client) 37 37 end 38 38
+8 -8
apps/sower/lib/sower/orchestration/garden.ex
··· 28 28 field :name, :string 29 29 field :local_sid, :string 30 30 field :org_id, Ecto.UUID 31 - field :boruta_client_id, :string 31 + field :oauth_client_id, :string 32 32 33 33 has_many :subscriptions, Sower.Orchestration.Subscription 34 34 has_many :deployments, Sower.Orchestration.Deployment ··· 42 42 @doc false 43 43 def changeset(garden, attrs) do 44 44 garden 45 - |> cast(attrs, [:name, :org_id, :local_sid, :boruta_client_id]) 45 + |> cast(attrs, [:name, :org_id, :local_sid, :oauth_client_id]) 46 46 |> validate_required([:name]) 47 47 end 48 48 ··· 207 207 208 208 def get_garden_sid(sid), do: Repo.get_by(__MODULE__, sid: sid) 209 209 210 - def get_by_boruta_client_id(client_id), 211 - do: Repo.get_by(__MODULE__, [boruta_client_id: client_id], skip_org_id: true) 210 + def get_by_oauth_client_id(client_id), 211 + do: Repo.get_by(__MODULE__, [oauth_client_id: client_id], skip_org_id: true) 212 212 213 213 def get_garden_local_sid(local_sid), do: Repo.get_by(__MODULE__, local_sid: local_sid) 214 214 ··· 217 217 def register_new_garden(%{public_key: public_key} = attrs) do 218 218 with {:ok, garden} <- create_garden(attrs), 219 219 {:ok, client} <- Sower.GardenAuth.create_client(garden.sid, public_key), 220 - {:ok, garden} <- update_garden(garden, %{boruta_client_id: client.id}) do 220 + {:ok, garden} <- update_garden(garden, %{oauth_client_id: client.id}) do 221 221 {:ok, garden, %{client_id: client.id}} 222 222 else 223 223 {:error, reason} -> ··· 242 242 end 243 243 244 244 def delete_garden(%__MODULE__{} = garden) do 245 - if garden.boruta_client_id do 245 + if garden.oauth_client_id do 246 246 try do 247 - Sower.GardenAuth.delete_client(garden.boruta_client_id) 247 + Sower.GardenAuth.delete_client(garden.oauth_client_id) 248 248 rescue 249 249 Ecto.NoResultsError -> 250 250 Logger.warning( 251 251 msg: "Boruta client not found during garden deletion", 252 - boruta_client_id: garden.boruta_client_id 252 + oauth_client_id: garden.oauth_client_id 253 253 ) 254 254 end 255 255 end
+2 -2
apps/sower/lib/sower_web/garden_socket.ex
··· 34 34 defp authenticate_token("boruta:" <> boruta_token) do 35 35 case Boruta.Oauth.Authorization.AccessToken.authorize(value: boruta_token) do 36 36 {:ok, oauth_token} -> 37 - case Sower.Orchestration.Garden.get_by_boruta_client_id(oauth_token.client.id) do 37 + case Sower.Orchestration.Garden.get_by_oauth_client_id(oauth_token.client.id) do 38 38 nil -> 39 39 Logger.error( 40 40 msg: "No garden found for Boruta client", 41 - boruta_client_id: oauth_token.client.id 41 + oauth_client_id: oauth_token.client.id 42 42 ) 43 43 44 44 {:error, :unknown_client}
+2 -2
apps/sower/priv/repo/migrations/20260401010000_add_boruta_client_id_to_gardens.exs
··· 3 3 4 4 def change do 5 5 alter table(:gardens) do 6 - add :boruta_client_id, :string 6 + add :oauth_client_id, :string 7 7 end 8 8 9 - create index(:gardens, [:boruta_client_id], unique: true) 9 + create index(:gardens, [:oauth_client_id], unique: true) 10 10 end 11 11 end