diff --git a/accounts/index.js b/accounts/index.js index d05c8f4dc8..7ea137a38a 100755 --- a/accounts/index.js +++ b/accounts/index.js @@ -4,7 +4,18 @@ const app = express(); app.use(express.static(path.join(__dirname, 'build'))); -app.get('/*', function(req, res) { +var env = { + TEST: 'TEST', + FYIPE_HOSTED: process.env.FYIPE_HOSTED, + HOST: process.env.HOST, + ACCOUNTS_HOST: process.env.ACCOUNTS_HOST, + BACKEND_HOST: process.env.BACKEND_HOST +} + +app.get('/env', function (req, res) { + res.send(JSON.stringify(env)); +}) +app.get('/*', function (req, res) { res.sendFile(path.join(__dirname, 'build', 'index.html')); }); diff --git a/accounts/src/config.js b/accounts/src/config.js index 3cf49640f5..ea5ecd604c 100755 --- a/accounts/src/config.js +++ b/accounts/src/config.js @@ -29,20 +29,29 @@ let adminDashboardUrl = null; // } - -if (!isServer) { - if (window.location.href.indexOf('localhost') > -1) { - apiUrl = 'http://localhost:3002'; - dashboardUrl = 'http://localhost:3000'; - domain = 'localhost'; - adminDashboardUrl = 'http://localhost:3100'; - } else { - apiUrl = 'http://backend:3002'; - dashboardUrl = 'http://dashboard:3000'; - domain = 'local'; - } +function getEnvVars(){ + axios.get('http://localhost:3003/env') + .then(resp => resp.data) + .then(env => { + if (!isServer) { + if (window.location.href.indexOf('localhost') > -1) { + apiUrl = 'http://localhost:3002'; + dashboardUrl = 'http://localhost:3000'; + domain = 'localhost'; + adminDashboardUrl = 'http://localhost:3100'; + } else { + domain = 'local'; + apiUrl = env.BACKEND_HOST; + dashboardUrl = env.DASHBOARD_HOST; + } + } + }) + .catch(err => { + console.log(err) + }) } +getEnvVars(); export const API_URL = apiUrl; diff --git a/kubernetes/ci/ci-server.yaml b/kubernetes/ci/ci-server.yaml index bd54bc0f1a..53e597c834 100644 --- a/kubernetes/ci/ci-server.yaml +++ b/kubernetes/ci/ci-server.yaml @@ -82,11 +82,11 @@ spec: - name: FYIPE_HOSTED value: "true" - name: HOST - value: "accounts" + value: "accounts:3003" - name: BACKEND_HOST - value: "backend" + value: "backend:3002" - name: DASHBOARD_HOST - value: "dashboard" + value: "dashboard:3000" ports: - containerPort: 3003 hostPort: 3003