Skip to content

Commit eddb78b

Browse files
committed
incorporating base bucket url
1 parent 35def86 commit eddb78b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

.github/workflows/deploy-staging.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
with:
4242
service: "staging-media-server"
4343
image: "vnguyen/openbeta-media-server:staging"
44+
env_vars: |
45+
STORAGE_BUCKET=openbeta-staging
4446
4547
- name: "Use output"
4648
run: 'curl "${{ steps.deploy.outputs.url }}"'

app.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ const sharp = require("sharp");
66
const app = express();
77
const PORT = 8080;
88
const HOST = "0.0.0.0";
9-
const BASE_STORAGE_IMAGE_URL = "https://storage.googleapis.com";
9+
const BASE_STORAGE_IMAGE_URL = "https://storage.googleapis.com/";
10+
const BUCKET = process.env.STORAGE_BUCKET || "openbeta-prod";
1011

1112
const getImage = (path) =>
1213
fetch(path).then(async (r) => ({
@@ -24,7 +25,7 @@ app.get("/healthy", (req, res) => {
2425
app.get("*", async (req, res) => {
2526
try {
2627
const { searchParams, pathname, href } = new URL(
27-
`${BASE_STORAGE_IMAGE_URL}${req.url}`,
28+
`${BASE_STORAGE_IMAGE_URL}${BUCKET}${req.url}`,
2829
);
2930

3031
if (!/\.(jpe?g|png|gif|webp)$/i.test(pathname)) {

0 commit comments

Comments
 (0)