Skip to content

Commit 688516e

Browse files
add environment inforamtion
1 parent 7563966 commit 688516e

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

lib/logic/api/environment.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,30 @@ const CFError = require('cf-errors'); // eslint-disable-line
33
const { sendHttpRequest } = require('./helper');
44
const Environment = require('../entities/Environment');
55

6-
const _extractFieldsForEnvironmentEntity = environment => ({
7-
id: environment._id,
8-
status: environment.creationStatus,
9-
name: environment.name,
10-
});
6+
const _getServiceInfo = (environment) => {
7+
let services = [];
8+
for (let i=0 ; i<environment.instances.length; i++){
9+
const service = environment.instances[i];
10+
services.push({
11+
serviceName: service.serviceName,
12+
image: service.image,
13+
sha: service.sha,
14+
branch: service.branch,
15+
repoName: service.repoName,
16+
serviceURL: service.urls,
17+
});
18+
};
19+
return services;
20+
};
21+
22+
const _extractFieldsForEnvironmentEntity = (environment) => {
23+
return {
24+
id: environment._id,
25+
status: environment.creationStatus,
26+
name: environment.name,
27+
servicesInfo: _getServiceInfo(environment),
28+
};
29+
};
1130

1231
const getEnvironmentById = async (id) => {
1332
const endcodeUri = encodeURIComponent(id);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.8.37",
3+
"version": "0.8.38",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)