Skip to content

Commit 3a66a77

Browse files
committed
link fe to question-service on kubernetes
1 parent 7067b9d commit 3a66a77

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/.pnp
66
.pnp.js
77
.yarn/install-state.gz
8+
.vscode
89

910
# testing
1011
/coverage

k8s/peerprep-fe.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
containers:
2121
- name: peerprep-fe
2222
image: asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest
23+
# imagePullPolicy: Never # only used for local builds
2324
ports:
2425
- containerPort: 3000
2526
---

k8s/question-service.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,23 @@ spec:
2020
containers:
2121
- name: question-svc
2222
image: asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest
23+
# imagePullPolicy: Never # only used for local builds
2324
ports:
2425
- containerPort: 4001
26+
envFrom:
27+
- configMapRef:
28+
name: question-service-config
29+
dnsPolicy: ClusterFirst
2530
---
31+
# This is an internal service, not exposed
2632
apiVersion: v1
2733
kind: Service
2834
metadata:
2935
name: question-svc
3036
spec:
3137
type: LoadBalancer
3238
ports:
33-
- port: 80
39+
- port: 4001
3440
targetPort: 4001
3541
selector:
3642
type: backend

peerprep-fe/.env

Whitespace-only changes.

question-service/src/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ dotenv.config({ path: '.env.dev' });
99

1010
const app = express();
1111
const PORT = process.env.PORT || 4001; // 4001 to prevent conflicts
12+
const corsFrontendUrl =
13+
process.env.CORS_FRONTEND_URL || 'http://localhost:3000';
1214

1315
app.use(express.json());
1416

1517
const apiVersion = '/api/v1';
1618

1719
app.use(
1820
cors({
19-
origin: 'http://localhost:3000', // Allow requests from your frontend
21+
origin: corsFrontendUrl, // Allow requests from your frontend
2022
methods: ['GET', 'POST', 'PUT', 'DELETE'], // Specify the methods allowed
2123
credentials: true, // Allow credentials if needed
2224
}),

0 commit comments

Comments
 (0)