diff --git a/frontend/.env.development b/frontend/.env.development new file mode 100644 index 000000000..531964bd7 --- /dev/null +++ b/frontend/.env.development @@ -0,0 +1 @@ +VITE_API_HOST=http://localhost:5000 \ No newline at end of file diff --git a/frontend/.env.production b/frontend/.env.production new file mode 100644 index 000000000..8270d9892 --- /dev/null +++ b/frontend/.env.production @@ -0,0 +1 @@ +VITE_API_HOST=https://basegun.fr/api/ \ No newline at end of file diff --git a/frontend/nginx.conf b/frontend/nginx.conf index f72c168dc..041754761 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -15,14 +15,6 @@ http { try_files $uri $uri/ /index.html; } - location /api/ { - proxy_pass http://basegun-backend:5000/; - client_max_body_size 5M; - proxy_read_timeout 1800; - proxy_connect_timeout 1800; - proxy_send_timeout 1800; - } - error_page 404 /404.html; error_page 500 502 503 504 /50x.html; diff --git a/frontend/src/main.js b/frontend/src/main.js index e047ab461..9702a68c6 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -18,7 +18,7 @@ const pinia = createPinia() axios.defaults.withCredentials = true // the FastAPI backend -axios.defaults.baseURL = '/api/' +axios.defaults.baseURL = import.meta.env.VITE_API_HOST const app = createApp(App) diff --git a/infra/kube/helm/templates/ingress.yaml b/infra/kube/helm/templates/ingress.yaml index 9e72b1fe3..fe70e8cf5 100644 --- a/infra/kube/helm/templates/ingress.yaml +++ b/infra/kube/helm/templates/ingress.yaml @@ -1,18 +1,5 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := include "basegun.chart" . -}} -{{- $svcPort := .Values.frontend.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} kind: Ingress metadata: name: "basegun-ingress" @@ -23,9 +10,7 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} ingressClassName: {{ .Values.ingress.className }} - {{- end }} {{- if .Values.ingress.tls }} tls: {{- range .Values.ingress.tls }} @@ -40,22 +25,20 @@ spec: {{- range .Values.ingress.hosts }} - host: {{ .host | quote }} http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: "basegun-frontend" - port: - number: {{ $svcPort }} - {{- else }} - serviceName: "basegun-frontend" - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} + paths: + - path: / + pathType: Prefix + backend: + service: + name: basegun-frontend + port: + number: {{ $.Values.client.service.port }} + - path: /api/ + pathType: Prefix + backend: + service: + name: basegun-backend + port: + number: {{ $.Values.server.service.port }} {{- end }} -{{- end }} +{{- end }} \ No newline at end of file