Skip to content

Commit

Permalink
hard coded frontend url for cors
Browse files Browse the repository at this point in the history
  • Loading branch information
caitoor committed May 6, 2024
1 parent efc7ad1 commit 9b4f735
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
.env.example
readme.md
.github
docker-compose.yml
docker-compose.yml
.gitignore
8 changes: 0 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,5 @@ WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
ARG API_PORT
ARG DOMAIN
ARG BACKEND_SUBDOMAIN
ARG VITE_API_BASE_URL
ENV API_PORT=$API_PORT
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
ENV DOMAIN=$DOMAIN
ENV BACKEND_SUBDOMAIN=$BACKEND_SUBDOMAIN
EXPOSE 3000
CMD [ "node", "index.js" ]
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ mongoose.connect(mongoUri)
.then(() => console.log('MongoDB connection successful'))
.catch(err => console.error('MongoDB connection error:', err));

const frontendUrl = `https://${process.env.FRONTEND_SUBDOMAIN}.${process.env.DOMAIN}/`;
// the following leads to undefined url in the container:
// const frontendUrl = `https://${process.env.FRONTEND_SUBDOMAIN}.${process.env.DOMAIN}/`;

const frontendUrl = "https://starbugs_api.sweavs.de";
console.log(`frontendUrl: ${frontendUrl}`);

const corsOptions = {
Expand Down

0 comments on commit 9b4f735

Please sign in to comment.