Skip to content
Snippets Groups Projects
Commit ac99daf1 authored by derrabauke's avatar derrabauke
Browse files

tried to connect the client with backend

- via env vars but it seems to be hard in minikube enviroment
parent bdd38af5
No related branches found
No related tags found
No related merge requests found
......@@ -7,12 +7,13 @@ WORKDIR /usr/src/app
COPY package*.json ./
ENV PATH /usr/src/app/node_modules/.bin:$PATH
ENV API_URL backend://backend:3002
RUN npm install --silent
COPY . .
RUN npm run build
RUN API_URL=$API_URL node scripts/build.js
# Put this stuff into a nginx server
FROM nginx:latest
......
......@@ -33,6 +33,9 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: API_URL
value: "{{ .Values.backendName}}://{{ .Values.backendName }}:{{ .Values.backendPort }}"
ports:
- name: http
containerPort: 80
......
......@@ -3,12 +3,13 @@
# Declare variables to be passed into your templates.
replicaCount: 1
backendName: "backend"
backendPort: "3002"
image:
repository: client # !Change this to the actual image
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.0.1"
tag: "v0.0.2"
imagePullSecrets: []
nameOverride: ""
......@@ -41,13 +42,16 @@ service:
port: 80
ingress:
enabled: false
enabled: true
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
hosts:
- host: chart-example.local
paths: []
- host: backend
paths:
- path: /api
backend:
fullName: "backend"
tls: []
# - secretName: chart-example-tls
# hosts:
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -141,7 +141,8 @@ function build(previousFileSizes) {
);
console.log();
}
console.log("THIS IS THE API URL")
console.log(process.env.API_URL)
console.log('Creating an optimized production build...');
const compiler = webpack(config);
......
import axios from 'axios'
const axiosInstance = axios.create({
baseURL: process.env.PUBLIC_URL,
baseURL: process.env.API_URL,
withCredentials: true,
});
......@@ -16,7 +16,7 @@ axiosInstance.interceptors.response.use(
);
export const signout = () => {
return axiosInstance.post(process.env.PUBLIC_URL + '/logout').then(user => {
return axiosInstance.post('/logout').then(user => {
// delete axiosInstance.defaults.headers.common["Authorization"];
return user.data
})
......@@ -93,4 +93,4 @@ export const deleteTodo = (_id) => {
}).then(todo => {
return todo
})
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment