From 16f744690d2f21c3b6c71e73c78cc75c2cd8e0bb Mon Sep 17 00:00:00 2001 From: Omar Selo Date: Tue, 17 Oct 2023 13:59:12 +0300 Subject: [PATCH] Fix/frontend api connection on dev (#50) * Unused environment variable * Typo * Use localhost as placeholder url to work on dev --- backend/skaffold.yaml | 2 +- frontend/Dockerfile | 1 - frontend/charm/src/charm.py | 2 +- frontend/lib/providers/dio.dart | 4 ++-- frontend/web/index.html | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/backend/skaffold.yaml b/backend/skaffold.yaml index 19d9cede..1292fe3c 100644 --- a/backend/skaffold.yaml +++ b/backend/skaffold.yaml @@ -1,7 +1,7 @@ apiVersion: skaffold/v4beta4 kind: Config metadata: - name: test-observer-frontend + name: test-observer-api build: artifacts: - image: localhost:32000/test-observer-api diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 1ef0521b..76d53c78 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,6 +1,5 @@ FROM ubuntu:22.04 as builder -ENV TEST_OBSERVER_API_BASE_URI=http://localhost:30000 ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3 diff --git a/frontend/charm/src/charm.py b/frontend/charm/src/charm.py index b07b1875..93b6fbee 100755 --- a/frontend/charm/src/charm.py +++ b/frontend/charm/src/charm.py @@ -113,7 +113,7 @@ def nginx_config(self, base_uri: str) -> str: expires -1; add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"; - sub_filter 'http://api-placeholder:30000/' '{base_uri}'; + sub_filter 'http://localhost:30000/' '{base_uri}'; sub_filter_once on; }} diff --git a/frontend/lib/providers/dio.dart b/frontend/lib/providers/dio.dart index d9ef5537..1d83d20a 100644 --- a/frontend/lib/providers/dio.dart +++ b/frontend/lib/providers/dio.dart @@ -10,7 +10,7 @@ part 'dio.g.dart'; @riverpod Dio dio(DioRef ref) { - final baseUrl = js_util.getProperty(window, 'testObserverAPIBaseURI'); - final dio = Dio(BaseOptions(baseUrl: baseUrl ?? 'http://localhost:30000')); + final baseUrl = js_util.getProperty(window, 'testObserverAPIBaseURI'); + final dio = Dio(BaseOptions(baseUrl: baseUrl)); return dio; } diff --git a/frontend/web/index.html b/frontend/web/index.html index 55ec9aa6..902915ac 100644 --- a/frontend/web/index.html +++ b/frontend/web/index.html @@ -34,7 +34,7 @@