feat: implement server-side proxy with google-auth-library

Rewrite server.js to use google-auth-library for generating Google ID
tokens when authenticating requests to the backend Cloud Run service.

Key changes:
- Replace metadata server token fetch with GoogleAuth client
- Implement proper SSE streaming with raw byte passthrough
- Add health check endpoint for Cloud Run monitoring
- Update server to listen on 0.0.0.0:8080 for Cloud Run compatibility
- Add environment variable validation at startup
- Improve error handling and logging throughout request lifecycle

Update Dockerfile to install google-auth-library dependency and expose
port 8080 instead of port 80.
This commit is contained in:
Danny
2026-01-20 12:18:09 -06:00
parent 2e7db6a952
commit 2d35f2d498
2 changed files with 62 additions and 20 deletions
+2 -2
View File
@@ -11,6 +11,6 @@ FROM node:20-alpine
WORKDIR /app
COPY --from=build /app/dist ./dist
COPY server.js .
RUN npm install express@4
EXPOSE 80
RUN npm install express@4 google-auth-library
EXPOSE 8080
CMD ["node", "server.js"]