Skip to content

Commit

Permalink
refactor: remove API_ORIGIN from env
Browse files Browse the repository at this point in the history
  • Loading branch information
solufa committed Jun 8, 2024
1 parent b3d377a commit 9ad8b5c
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 28 deletions.
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ COPY . .

ARG SERVER_PORT=5000
ARG VERSION
ARG API_ORIGIN=http://localhost:$SERVER_PORT
ARG NEXT_PUBLIC_COGNITO_POOL_ENDPOINT=http://localhost:$SERVER_PORT
ARG NEXT_PUBLIC_COGNITO_POOL_ID=ap-northeast-1_randomPoolId
ARG NEXT_PUBLIC_COGNITO_CLIENT_ID=random-client-id
Expand All @@ -28,12 +27,10 @@ FROM node:20-alpine

WORKDIR /usr/src/app

ARG SERVER_PORT=5000
ARG CLIENT_PORT=5001

ENV PORT=$SERVER_PORT
ENV PORT=5000
ENV CLIENT_PORT=$CLIENT_PORT
ENV API_ORIGIN=http://localhost:$SERVER_PORT
ENV CORS_ORIGIN=http://localhost:$CLIENT_PORT
ENV DATABASE_URL=file:../../data/app.db
ENV SMTP_HOST=inbucket
Expand All @@ -53,9 +50,9 @@ COPY --from=builder /usr/src/app/server/prisma ./server/prisma
RUN apk --no-cache add curl
COPY --from=builder /usr/src/app/data ./data

HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD curl -f $API_ORIGIN/health && curl -f $CORS_ORIGIN || exit 1
HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD curl -f http://localhost:$PORT/health && curl -f $CORS_ORIGIN || exit 1

EXPOSE ${SERVER_PORT} ${CLIENT_PORT}
EXPOSE ${PORT} ${CLIENT_PORT}
VOLUME ["/usr/src/app/data"]

CMD ["npm", "start"]
6 changes: 0 additions & 6 deletions client/aspida.config.js

This file was deleted.

13 changes: 0 additions & 13 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"devDependencies": {
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"dotenv": "^16.4.5",
"happy-css-modules": "^2.1.2",
"notios": "^0.4.1",
"pathpida": "^0.22.0"
Expand Down
3 changes: 2 additions & 1 deletion client/utils/apiClient.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import aspida from '@aspida/axios';
import api from 'api/$api';
import axios from 'axios';
import { NEXT_PUBLIC_COGNITO_POOL_ENDPOINT } from './envValues';

export const apiClient = api(aspida(axios.create({ withCredentials: true })));
export const apiClient = api(aspida(axios.create({ baseURL: NEXT_PUBLIC_COGNITO_POOL_ENDPOINT })));
1 change: 0 additions & 1 deletion server/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PORT=5000
CLIENT_PORT=
API_ORIGIN=http://localhost:5000
CORS_ORIGIN=http://localhost:5001
DATABASE_URL=file:../../data/app.db
TEST_DATABASE_URL=file:../../data/test.db
Expand Down

0 comments on commit 9ad8b5c

Please sign in to comment.