Skip to content

Commit

Permalink
Allow setting destination image bucket details env in runtime config
Browse files Browse the repository at this point in the history
  • Loading branch information
skanderm committed Sep 10, 2024
1 parent 06a17d9 commit 5de46d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions server/config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ import Config
#
# Alternatively, you can use `mix phx.gen.release` to generate a `bin/server`
# script that automatically sets the env var above.

config :orcasite,
audio_image_bucket: System.get_env("ORCASITE_AUDIO_IMAGE_BUCKET", "audio-deriv-orcasound-net"),
audio_image_bucket_region: System.get_env("ORCASITE_AUDIO_IMAGE_BUCKET_REGION", "us-west-2")

if System.get_env("PHX_SERVER") do
config :orcasite, OrcasiteWeb.Endpoint, server: true
end
Expand Down
14 changes: 12 additions & 2 deletions server/lib/orcasite/radio/audio_image.ex
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,18 @@ defmodule Orcasite.Radio.AudioImage do
end

change set_attribute(:image_type, arg(:image_type))
change set_attribute(:bucket, "dev-audio-viz")
change set_attribute(:bucket_region, "us-west-2")

change fn change, _context ->
change
|> Ash.Changeset.change_attribute(
:bucket,
Application.fetch_env!(:orcasite, :audio_image_bucket)
)
|> Ash.Changeset.change_attribute(
:bucket_region,
Application.fetch_env!(:orcasite, :audio_image_bucket_region)
)
end

change before_action(fn change, _context ->
feed_segment_id = Ash.Changeset.get_argument(change, :feed_segment_id)
Expand Down

0 comments on commit 5de46d5

Please sign in to comment.