From e1bd9bd3bb3b0de769ccf007e3b835593ab0ae31 Mon Sep 17 00:00:00 2001 From: robinsonkwame Date: Thu, 3 May 2018 18:49:16 -0400 Subject: [PATCH] WIP: attempting to read in env, javascript/angaular is defintely not what i know --- src/app/skill-labeller/labels.services.ts | 9 +++++++-- src/environments/environment.prod.ts | 4 +++- src/environments/environment.ts | 4 +++- standalone/dispatcher.env | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app/skill-labeller/labels.services.ts b/src/app/skill-labeller/labels.services.ts index fe75c54..450993f 100644 --- a/src/app/skill-labeller/labels.services.ts +++ b/src/app/skill-labeller/labels.services.ts @@ -1,6 +1,11 @@ +import { environment} from '../../environments/environment' + export class LabelsService { - putCandidateLabelEndpoint = ''; - getCandidateEndpoint = ''; + dispatcherEndpoint = new URL("http://" + environment.dispatcher_host + ":" + environment.dispatcher_port); + + getCandidateEndpoint = URL(environment.dispatcher_get, dispatcherEndpoint); + putCandidateEndpoint = URL(environment.dispatcher_put, dispatcherEndpoint); + dispatcher = 'https://jsonplaceholder.typicode.com/posts/1'; data = { method: 'post', diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3612073..ef06d27 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,3 +1,5 @@ export const environment = { - production: true + production: true, + dispatcher_host: "${process.env.DISPATCHER_HOST}", + dispatcher_port: "${process.env.DISPATCHER_PORT}", }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index b7f639a..2277a6b 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,5 +4,7 @@ // The list of which env maps to which file can be found in `.angular-cli.json`. export const environment = { - production: false + production: false, + dispatcher_host: "${process.env.DISPATCHER_HOST}", + dispatcher_port: "${process.env.DISPATCHER_PORT}", }; diff --git a/standalone/dispatcher.env b/standalone/dispatcher.env index 055a822..a05ebee 100644 --- a/standalone/dispatcher.env +++ b/standalone/dispatcher.env @@ -1,2 +1,2 @@ DISPATCHER_HOST=localhost -DISPATCHER_POST=8000 +DISPATCHER_PORT=8000