Skip to content

Commit

Permalink
Fix/frontend api connection on dev (#50)
Browse files Browse the repository at this point in the history
* Unused environment variable

* Typo

* Use localhost as placeholder url to work on dev
  • Loading branch information
omar-selo authored Oct 17, 2023
1 parent 23abfa6 commit 16f7446
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/skaffold.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion frontend/charm/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}}
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/providers/dio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>(window, 'testObserverAPIBaseURI');
final dio = Dio(BaseOptions(baseUrl: baseUrl));
return dio;
}
2 changes: 1 addition & 1 deletion frontend/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

<script>
// Actual URL is set at runtime with some nginx config level trickery.
window.testObserverAPIBaseURI = 'http://api-placeholder:30000/';
window.testObserverAPIBaseURI = 'http://localhost:30000/';
</script>

<script>
Expand Down

0 comments on commit 16f7446

Please sign in to comment.