From 6012dbaaf85ef75d6980ffda3b0ada7e6440478e Mon Sep 17 00:00:00 2001 From: marcel-dempers Date: Sun, 27 Sep 2020 11:25:40 +1000 Subject: [PATCH] dynamic url for localhost + ingress functionality --- .../servicemesh/applications/videos-web/index.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/kubernetes/servicemesh/applications/videos-web/index.html b/kubernetes/servicemesh/applications/videos-web/index.html index ca65fe4..8402367 100644 --- a/kubernetes/servicemesh/applications/videos-web/index.html +++ b/kubernetes/servicemesh/applications/videos-web/index.html @@ -3,7 +3,7 @@ - + Video Catalog @@ -68,10 +68,17 @@ playlist: [], }; + var playlistApiUrl = ""; + if (location.hostname == "localhost"){ + playlistApiUrl = "http://localhost:81/" + } else { + playlistApiUrl = "http://" + location.hostname + "/api/playlists" + } + var app = angular.module('videos', []); app.controller('videosController', function ($scope, $http) { - $http.get("http://localhost:81/") + $http.get(playlistApiUrl) .then(function (response) { console.log(response);