Skip to content

Commit

Permalink
WIP: successfully pulls variables from environment
Browse files Browse the repository at this point in the history
  • Loading branch information
robinsonkwame committed May 4, 2018
1 parent e1bd9bd commit fbad220
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app/skill-labeller/labels.services.ts
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -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){
Expand Down
2 changes: 2 additions & 0 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
};
2 changes: 2 additions & 0 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
};

0 comments on commit fbad220

Please sign in to comment.