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

Commit a105280

Browse files
authored
Fix tsconfig.json for backward compatibility for docker env (#185)
* BE-831 Transcode to typescript Signed-off-by: Atsushi Neki <atsushin@fast.au.fujitsu.com> * BE-831 Fix directory structure for keeping compatibility For container environment, reverted root path for app from dist/ to app/. Signed-off-by: Atsushi Neki <atsushin@fast.au.fujitsu.com>
1 parent 65b5001 commit a105280

File tree

19 files changed

+48
-43
lines changed

19 files changed

+48
-43
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ ENV DATABASE_PORT 5432
5151
ENV DATABASE_NAME fabricexplorer
5252
ENV DATABASE_USERNAME hppoc
5353
ENV DATABASE_PASSWD password
54+
ENV EXPLORER_APP_ROOT app
5455

5556
ENV DEFAULT_WORKDIR /opt
5657
ENV EXPLORER_APP_PATH $DEFAULT_WORKDIR/explorer
5758

5859
WORKDIR $EXPLORER_APP_PATH
5960

6061
COPY . .
61-
COPY --from=BUILD_IMAGE $EXPLORER_APP_PATH/dist ./dist/
62+
COPY --from=BUILD_IMAGE $EXPLORER_APP_PATH/dist ./app/
6263
COPY --from=BUILD_IMAGE $EXPLORER_APP_PATH/client/build ./client/build/
6364
COPY --from=BUILD_IMAGE $EXPLORER_APP_PATH/node_modules ./node_modules/
6465

app/Explorer.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ import {platformroutes} from './rest/platformroutes';
1717
import {adminroutes} from './platform/fabric/rest/adminroutes';
1818
import {explorerConst} from './common/ExplorerConst'
1919
import {explorerError} from './common/ExplorerMessage'
20-
import authCheckMiddleware from './middleware/auth-check';
21-
import swaggerDocument from '../swagger.json';
20+
import {authCheckMiddleware} from './middleware/auth-check';
21+
import swaggerDocument from './swagger.json';
2222
import {ExplorerError} from './common/ExplorerError';
23-
const localLoginStrategy = require('./passport/local-login');
23+
import {localLoginStrategy} from './passport/local-login';
24+
2425
/**
2526
*
2627
*
File renamed without changes.

main.ts renamed to app/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Created by shouhewu on 6/8/17.
88
*
99
*/
10-
import {helper} from './app/common/helper';
10+
import {helper} from './common/helper';
1111

1212
import express from 'express';
1313
import helmet from 'helmet';
@@ -21,8 +21,8 @@ import appconfig from './appconfig.json';
2121

2222
const logger = helper.getLogger('main');
2323

24-
import {Explorer} from './app/Explorer';
25-
import {ExplorerError} from './app/common/ExplorerError';
24+
import {Explorer} from './Explorer';
25+
import {ExplorerError} from './common/ExplorerError';
2626

2727
const sslEnabled = process.env.SSL_ENABLED || appconfig.sslEnabled;
2828
const sslCertsPath = process.env.SSL_CERTS_PATH || appconfig.sslCertsPath;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const config = require('../explorerconfig.json');
1111
/**
1212
* The Auth Checker middleware function.
1313
*/
14-
module.exports = (req, res, next) => {
14+
export const authCheckMiddleware = (req, res, next) => {
1515
if (!req.headers.authorization) {
1616
return res.status(401).end();
1717
}
File renamed without changes.
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const config = require('../explorerconfig.json');
1414
// @ts-check
1515
const jwtSignAsync = promisify(jwt.sign);
1616

17-
const strategy = function(platform) {
17+
export const localLoginStrategy = function(platform) {
1818
const proxy = platform.getProxy();
1919
return new PassportLocalStrategy(
2020
{
@@ -47,15 +47,9 @@ const strategy = function(platform) {
4747
// @ts-check
4848
const data = {
4949
message: 'logged in',
50-
name: userData.user,
51-
network: userData.network
50+
name: userData.user
5251
};
5352
return done(null, token, data);
5453
}
5554
);
5655
};
57-
58-
/**
59-
* Return the Passport Local Strategy object.
60-
*/
61-
module.exports = strategy;

app/persistence/PersistenceFactory.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class PersistenceFactory {
2222
* @memberof PersistenceFactory
2323
*/
2424
static async create(db: string, dbconfig: any) {
25-
console.log("check",explorerConst.PERSISTENCE_POSTGRESQL)
2625
if (db === explorerConst.PERSISTENCE_POSTGRESQL) {
2726
// Avoid to load all db Persist module
2827
const PostgreSQL = require('./postgreSQL/Persist');

app/platform/fabric/FabricConfig.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export class FabricConfig {
246246

247247
if (organization.signedCert.path !== undefined) {
248248
return fs.readFileSync(
249-
path.resolve(__dirname, '../../../..', organization.signedCert.path),
249+
path.resolve(__dirname, '../../..', organization.signedCert.path),
250250
'utf8'
251251
);
252252
}
@@ -272,7 +272,7 @@ export class FabricConfig {
272272

273273
if (organization.adminPrivateKey.path !== undefined) {
274274
return fs.readFileSync(
275-
path.resolve(__dirname, '../../../..', organization.adminPrivateKey.path),
275+
path.resolve(__dirname, '../../..', organization.adminPrivateKey.path),
276276
'utf8'
277277
);
278278
}
@@ -297,7 +297,7 @@ export class FabricConfig {
297297

298298
if (tlsCACerts.path !== undefined) {
299299
return fs.readFileSync(
300-
path.resolve(__dirname, '../../../..', tlsCACerts.path),
300+
path.resolve(__dirname, '../../..', tlsCACerts.path),
301301
'utf8'
302302
);
303303
}

app/platform/fabric/sync/SyncService.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ export class SyncServices {
450450
const notify = {
451451
notify_type: fabric_const.NOTITY_TYPE_NEWCHANNEL,
452452
network_id,
453-
chName
453+
channel_name: chName
454454
};
455455

456456
_self.platform.send(notify);
@@ -475,7 +475,7 @@ export class SyncServices {
475475
const notify = {
476476
notify_type: fabric_const.NOTITY_TYPE_UPDATECHANNEL,
477477
network_id,
478-
chName
478+
channel_name: chName
479479
};
480480

481481
_self.platform.send(notify);
@@ -617,7 +617,7 @@ export class SyncServices {
617617
const notify = {
618618
notify_type: fabric_const.NOTITY_TYPE_CHAINCODE,
619619
network_id,
620-
chName
620+
channel_name: chName
621621
};
622622

623623
_self.platform.send(notify);

0 commit comments

Comments
 (0)