Skip to content

Commit 2d50c97

Browse files
committed
feat: add storage URL config and routing
1 parent 37fe68a commit 2d50c97

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

config/dev.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ config :algora,
153153
plausible_embed_url: System.get_env("PLAUSIBLE_EMBED_URL"),
154154
posthog_project_id: System.get_env("POSTHOG_PROJECT_ID"),
155155
assets_url: System.get_env("ASSETS_URL"),
156+
storage_url: System.get_env("STORAGE_URL"),
156157
ingest_url: System.get_env("INGEST_URL"),
157158
ingest_static_url: System.get_env("INGEST_STATIC_URL"),
158159
ingest_token: System.get_env("INGEST_TOKEN")

config/runtime.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ if config_env() == :prod do
164164
plausible_embed_url: System.get_env("PLAUSIBLE_EMBED_URL"),
165165
posthog_project_id: System.get_env("POSTHOG_PROJECT_ID"),
166166
assets_url: System.get_env("ASSETS_URL"),
167+
storage_url: System.get_env("STORAGE_URL"),
167168
ingest_url: System.get_env("INGEST_URL"),
168169
ingest_static_url: System.get_env("INGEST_STATIC_URL"),
169170
ingest_token: System.get_env("INGEST_TOKEN")

config/test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ config :algora, :discord, webhook_url: System.get_env("DISCORD_WEBHOOK_URL")
6969
config :algora,
7070
plausible_embed_url: System.get_env("PLAUSIBLE_EMBED_URL"),
7171
assets_url: System.get_env("ASSETS_URL"),
72+
storage_url: System.get_env("STORAGE_URL"),
7273
ingest_url: System.get_env("INGEST_URL"),
7374
ingest_static_url: System.get_env("INGEST_STATIC_URL"),
7475
ingest_token: System.get_env("INGEST_TOKEN")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
defmodule AlgoraWeb.Plugs.RewriteStoragePlug do
2+
@moduledoc false
3+
alias AlgoraWeb.Plugs.RuntimeRewritePlug
4+
5+
defdelegate init(opts), to: RuntimeRewritePlug
6+
defdelegate call(conn, opts), to: RuntimeRewritePlug
7+
end

lib/algora_web/router.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ defmodule AlgoraWeb.Router do
4040

4141
scope "/" do
4242
forward "/asset", AlgoraWeb.Plugs.RewriteAssetsPlug, upstream: :assets_url
43+
forward "/storage", AlgoraWeb.Plugs.RewriteStoragePlug, upstream: :storage_url
4344
forward "/ingest/static", AlgoraWeb.Plugs.RewriteIngestStaticPlug, upstream: :ingest_static_url
4445
forward "/ingest", AlgoraWeb.Plugs.RewriteIngestPlug, upstream: :ingest_url
4546
forward "/observe/script.js", AlgoraWeb.Plugs.RewriteObserveJSPlug, upstream: "https://plausible.io/js/script.js"

0 commit comments

Comments
 (0)