Skip to content

Commit

Permalink
Add client app env env var
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoutsilis committed Mar 9, 2024
1 parent b8eacea commit f174f1c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Install the following tools in you system

Create the following secrets
```sh
kubectl create secret generic app-env --from-literal=APP_ENV=development
kubectl create secret generic jwt-secret --from-literal=JWT_KEY=<secret>
kubectl create secret generic stripe-secret --from-literal=STRIPE_KEY=<secret>
```
Expand Down
19 changes: 13 additions & 6 deletions client/api/build-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@ import axios from "axios";
export default ({ req }) => {
if (typeof window === "undefined") {
//on the server
return axios.create({
baseURL: "http://www.tixmix.store/",
// baseURL:
// "http://ingress-nginx-controller.ingress-nginx.svc.cluster.local",
headers: req.headers,
});
// TODO: Probably need to improve that,
// but this is a future Konstantinos problem :)
if (process.env.APP_ENV.toLowerCase() === "development") {
return axios.create({
baseURL:
"http://ingress-nginx-controller.ingress-nginx.svc.cluster.local",
headers: req.headers,
});
} else {
return axios.create({
baseURL: "http://www.tixmix.store/",
});
}
} else {
return axios.create({ baseURL: "/" });
}
Expand Down
7 changes: 7 additions & 0 deletions infra/k8s/client-depl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ spec:
containers:
- name: client
image: kkoutsilis/client
env:
- name: APP_ENV
valueFrom:
secretKeyRef:
name: app-env
key: APP_ENV

---
apiVersion: v1
kind: Service
Expand Down

0 comments on commit f174f1c

Please sign in to comment.