From fbad22064d576022310e9e1bb41accd1c877dd72 Mon Sep 17 00:00:00 2001 From: robinsonkwame Date: Fri, 4 May 2018 07:39:38 -0400 Subject: [PATCH] WIP: successfully pulls variables from environment --- src/app/skill-labeller/labels.services.ts | 9 +++++---- src/environments/environment.prod.ts | 2 ++ src/environments/environment.ts | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app/skill-labeller/labels.services.ts b/src/app/skill-labeller/labels.services.ts index 450993f..48fb2eb 100644 --- a/src/app/skill-labeller/labels.services.ts +++ b/src/app/skill-labeller/labels.services.ts @@ -1,10 +1,11 @@ import { environment} from '../../environments/environment' export class LabelsService { - dispatcherEndpoint = new URL("http://" + environment.dispatcher_host + ":" + environment.dispatcher_port); + // would use URL but isn't working as I expect + dispatcherEndpoint = "http://" + environment.dispatcher_host + ":" + environment.dispatcher_port; - getCandidateEndpoint = URL(environment.dispatcher_get, dispatcherEndpoint); - putCandidateEndpoint = URL(environment.dispatcher_put, dispatcherEndpoint); + getCandidateEndpoint = this.dispatcherEndpoint + environment.dispatcher_get; + putCandidateEndpoint = this.dispatcherEndpoint + environment.dispatcher_put; dispatcher = 'https://jsonplaceholder.typicode.com/posts/1'; data = { @@ -125,7 +126,7 @@ export class LabelsService { this.data["body"]["label"] = label; this.data["body"]["uuid"] = uuid; - return fetch(this.putCandidateLabelEndpoint, + return fetch(this.putCandidateEndpoint, JSON.stringify(this.data["body"])) .then(function(response) { if (!response.ok){ diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index ef06d27..1905ef9 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -2,4 +2,6 @@ export const environment = { production: true, dispatcher_host: "${process.env.DISPATCHER_HOST}", dispatcher_port: "${process.env.DISPATCHER_PORT}", + dispatcher_get: "${process.env.DISPATCHER_GET}", + dispatcher_put: "${process.env.DISPATCHER_PUT}" }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 2277a6b..0ed9c5c 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -7,4 +7,6 @@ export const environment = { production: false, dispatcher_host: "${process.env.DISPATCHER_HOST}", dispatcher_port: "${process.env.DISPATCHER_PORT}", + dispatcher_get: "${process.env.DISPATCHER_GET}", + dispatcher_put: "${process.env.DISPATCHER_PUT}" };