Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM tatsushid/tinycore-node:6.6
ENV NODE_ENV production

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ENV REGISTRY http://9.10.79.72:4873/
# ENV REGISTRY http://apiconnect01.rchland.ibm.com:4873/
COPY package.json /usr/src/app/
RUN npm config set registry $REGISTRY \
&& npm install --production

COPY . /usr/src/app

EXPOSE 3000

CMD [ "npm", "start" ]
1 change: 0 additions & 1 deletion abc

This file was deleted.

17 changes: 9 additions & 8 deletions lib/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,15 @@ function performHandshake() {
port: process.env[env.APIMANAGER_PORT],
catalog: process.env[env.APIMANAGER_CATALOG],
};

utils.handshakeWithAPIm(apim, function(error, result) {
if (error) {
logger.error('not able to perform the handshake with APIM, error:', error);
} else {
clientID = result.clientID;
}
});
if (apim.host) {
utils.handshakeWithAPIm(apim, function(error, result) {
if (error) {
logger.error('not able to perform the handshake with APIM, error:', error);
} else {
clientID = result.clientID;
}
});
}
}

module.exports.mkPatch = mkPatch;
Expand Down
9 changes: 8 additions & 1 deletion lib/api-loader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var optimizedDataCache = lru({ max: 3 });
//data store address
var dsHost = '127.0.0.1';
var dsPort;
var odPath = '/api/optimizedData';

/*
* The "api-loader" middlware reads the optimizedData from the current snapshot
Expand All @@ -32,6 +33,12 @@ module.exports = function createApiLoaderMiddleware(options) {
return function(req, res, next) {
logger.debug('api-loader entry');
dsPort = process.env.DATASTORE_PORT;
if (process.env.DATASTORE_HOST) {
dsHost = process.env.DATASTORE_HOST;
}
if (process.env.OPTIMIZED_PATH) {
odPath = process.env.OPTIMIZED_PATH;
}

async.waterfall([
//get the current snapshot id
Expand Down Expand Up @@ -112,7 +119,7 @@ function doOptimizedDataRequest(snapshotId) {
protocol: 'http',
hostname: dsHost,
port: dsPort,
pathname: '/api/optimizedData',
pathname: odPath,
query: { filter: JSON.stringify(queryfilter) } };
var queryurl = url.format(queryurlObj);

Expand Down
3 changes: 3 additions & 0 deletions lib/microgw.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ exports.start = function(port) {
return new Promise(function(resolve, reject) {
ds.start(process.env.NODE_ENV === 'production')
.then(function(useHttps) {
if (process.env.DATASTORE_HOST) {
useHttps = true;
}
port = port || process.env.PORT || (useHttps ? 443 : 80);
logger.debug('starting gateway ', port);
if (useHttps) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
"loopback-component-explorer": "^2.3.0",
"loopback-connector-redis": "0.0.3",
"lru-cache": "^4.0.0",
"microgateway-datastore": "strongloop/microgateway-datastore",
"microgateway-util": "strongloop/microgateway-util",
"microgateway-datastore": "^1.x",
"microgateway-util": "^1.x",
"moment": "^2.11.2",
"multer": "^1.1.0",
"osenv": "^0.1.3",
Expand Down