Skip to content
This repository was archived by the owner on Dec 5, 2023. It is now read-only.

Commit 90765ad

Browse files
authored
Merge pull request #62 from microservices-demo/add-domain-to-endpoints
Add optional domain to endpoints
2 parents f82ebf4 + b353280 commit 90765ad

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

api/endpoints.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
(function (){
22
'use strict';
33

4+
var util = require('util');
5+
6+
var domain = "";
7+
process.argv.forEach(function (val, index, array) {
8+
var arg = val.split("=");
9+
if (arg.length > 1) {
10+
if (arg[0] == "--domain") {
11+
domain = "." + arg[1];
12+
console.log("Setting domain to:", domain);
13+
}
14+
}
15+
});
16+
417
module.exports = {
5-
catalogueUrl: "http://catalogue",
6-
tagsUrl: "http://catalogue/tags",
7-
cartsUrl: "http://cart/carts",
8-
ordersUrl: "http://orders",
9-
customersUrl: "http://user/customers",
10-
addressUrl: "http://user/addresses",
11-
cardsUrl: "http://user/cards",
12-
loginUrl: "http://user/login",
13-
registerUrl: "http://user/register",
18+
catalogueUrl: util.format("http://catalogue%s", domain),
19+
tagsUrl: util.format("http://catalogue%s/tags", domain),
20+
cartsUrl: util.format("http://cart%s/carts", domain),
21+
ordersUrl: util.format("http://orders%s", domain),
22+
customersUrl: util.format("http://user%s/customers", domain),
23+
addressUrl: util.format("http://user%s/addresses", domain),
24+
cardsUrl: util.format("http://user%s/cards", domain),
25+
loginUrl: util.format("http://user%s/login", domain),
26+
registerUrl: util.format("http://user%s/register", domain),
1427
};
1528
}());

0 commit comments

Comments
 (0)