File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ limitations under the License.
1313*/
1414import { Node } from './node' ;
1515import { Container , ContainerInfo } from 'dockerode' ;
16+ import { executeCommand } from '../helpers' ;
1617
1718export class CA extends Node {
1819 constructor ( container : Container , containerInfo : ContainerInfo ) {
@@ -21,7 +22,7 @@ export class CA extends Node {
2122
2223 async generateConfig ( ) {
2324 const def : any = await super . generateConfig ( ) ;
24- def [ 'ca_name' ] = this . getContainerName ( ) ;
25+ def [ 'ca_name' ] = await this . getCAName ( ) ;
2526 return def ;
2627 }
2728
@@ -32,6 +33,12 @@ export class CA extends Node {
3233 name = kebabToPascal ( name ) ;
3334 return name . substr ( 0 , name . length - 1 ) + name . charAt ( name . length - 1 ) . toUpperCase ( ) ;
3435 }
36+
37+ async getCAName ( ) {
38+ const command = `echo -n $FABRIC_CA_SERVER_CA_NAME` ;
39+ const result = await executeCommand ( this . container , [ '/bin/bash' , '-c' , command ] ) ;
40+ return result . toString ( 'utf8' ) . trim ( ) ;
41+ }
3542}
3643
3744function kebabToPascal ( str : string ) {
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ export class Node {
8080
8181 isRunningLocally ( ) {
8282 const addressInfo = this . getContainerAddress ( ) ;
83- if ( addressInfo . indexOf ( '0.0.0.0' ) !== - 1 ) {
83+ if ( addressInfo . indexOf ( '0.0.0.0' ) !== - 1 || addressInfo . indexOf ( 'localhost' ) !== - 1 ) {
8484 return true ;
8585 } else {
8686 return false ;
You can’t perform that action at this time.
0 commit comments