Skip to content

Commit

Permalink
incorporating base bucket url
Browse files Browse the repository at this point in the history
  • Loading branch information
enapupe committed Nov 3, 2023
1 parent 35def86 commit eddb78b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ jobs:
with:
service: "staging-media-server"
image: "vnguyen/openbeta-media-server:staging"
env_vars: |
STORAGE_BUCKET=openbeta-staging
- name: "Use output"
run: 'curl "${{ steps.deploy.outputs.url }}"'
5 changes: 3 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const sharp = require("sharp");
const app = express();
const PORT = 8080;
const HOST = "0.0.0.0";
const BASE_STORAGE_IMAGE_URL = "https://storage.googleapis.com";
const BASE_STORAGE_IMAGE_URL = "https://storage.googleapis.com/";
const BUCKET = process.env.STORAGE_BUCKET || "openbeta-prod";

const getImage = (path) =>
fetch(path).then(async (r) => ({
Expand All @@ -24,7 +25,7 @@ app.get("/healthy", (req, res) => {
app.get("*", async (req, res) => {
try {
const { searchParams, pathname, href } = new URL(
`${BASE_STORAGE_IMAGE_URL}${req.url}`,
`${BASE_STORAGE_IMAGE_URL}${BUCKET}${req.url}`,
);

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

0 comments on commit eddb78b

Please sign in to comment.