Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
d2c60740
Commit
d2c60740
authored
7 months ago
by
Javier Diaz
Browse files
Options
Downloads
Patches
Plain Diff
Code Cleanup
parent
ff0877b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!294
Release TeraFlowSDN 4.0
,
!259
Resolve "(CTTC) Replace DLT Gateway functionality with an opensource and Hyper Ledger v2.4+ compliant version"
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dlt/gateway/dltApp/src/fabricConnect.ts
+16
-12
16 additions, 12 deletions
src/dlt/gateway/dltApp/src/fabricConnect.ts
with
16 additions
and
12 deletions
src/dlt/gateway/dltApp/src/fabricConnect.ts
+
16
−
12
View file @
d2c60740
...
...
@@ -21,27 +21,27 @@ import { TextDecoder } from 'util';
import
*
as
dotenv
from
'
dotenv
'
;
dotenv
.
config
({
path
:
path
.
resolve
(
__dirname
,
'
..
'
,
'
.env
'
)
});
const
channelName
=
envOrDefault
(
'
CHANNEL_NAME
'
,
'
channel1
'
);
const
chaincodeName
=
envOrDefault
(
'
CHAINCODE_NAME
'
,
'
adrenalineDLT
'
);
const
mspId
=
envOrDefault
(
'
MSP_ID
'
,
'
Org1MSP
'
);
const
channelName
=
getEnvVar
(
'
CHANNEL_NAME
'
);
const
chaincodeName
=
getEnvVar
(
'
CHAINCODE_NAME
'
);
const
mspId
=
getEnvVar
(
'
MSP_ID
'
);
// Path to crypto materials.
const
cryptoPath
=
envOrDefault
(
'
CRYPTO_PATH
'
,
path
.
resolve
(
__dirname
,
'
..
'
,
'
..
'
,
'
..
'
,
'
test-network
'
,
'
organizations
'
,
'
peerOrganizations
'
,
'
org1.adrenaline.com
'
)
);
const
cryptoPath
=
getEnvVar
(
'
CRYPTO_PATH
'
);
// Path to user private key directory.
const
keyDirectoryPath
=
envOrDefault
(
'
KEY_DIRECTORY_PATH
'
,
path
.
resolve
(
cryptoPath
,
'
users
'
,
'
User1@org1.adrenaline.com
'
,
'
msp
'
,
'
keystore
'
)
);
const
keyDirectoryPath
=
getEnvVar
(
'
KEY_DIRECTORY_PATH
'
);
// Path to user certificate directory.
const
certDirectoryPath
=
envOrDefault
(
'
CERT_DIRECTORY_PATH
'
,
path
.
resolve
(
cryptoPath
,
'
users
'
,
'
User1@org1.adrenaline.com
'
,
'
msp
'
,
'
signcerts
'
)
);
const
certDirectoryPath
=
getEnvVar
(
'
CERT_DIRECTORY_PATH
'
);
// Path to peer tls certificate.
const
tlsCertPath
=
envOrDefault
(
'
TLS_CERT_PATH
'
,
path
.
resolve
(
cryptoPath
,
'
peers
'
,
'
peer1.org1.adrenaline.com
'
,
'
tls
'
,
'
ca.crt
'
)
);
const
tlsCertPath
=
getEnvVar
(
'
TLS_CERT_PATH
'
);
// Gateway peer endpoint.
const
peerEndpoint
=
envOrDefault
(
'
PEER_ENDPOINT
'
,
'
localhost:7051
'
);
const
peerEndpoint
=
getEnvVar
(
'
PEER_ENDPOINT
'
);
// Gateway peer SSL host name override.
const
peerHostAlias
=
envOrDefault
(
'
PEER_HOST_ALIAS
'
,
'
peer1.org1.adrenaline.com
'
);
const
peerHostAlias
=
getEnvVar
(
'
PEER_HOST_ALIAS
'
);
const
utf8Decoder
=
new
TextDecoder
();
const
assetId
=
`asset
${
Date
.
now
()}
`
;
...
...
@@ -154,10 +154,14 @@ async function initLedger(contract: Contract): Promise<void> {
/**
*
envOrDefault
() will return the value of an environment variable
, or a default value if the variable is undefined
.
*
getEnvVar
() will return the value of an environment variable.
*/
function
envOrDefault
(
key
:
string
,
defaultValue
:
string
):
string
{
return
process
.
env
[
key
]
||
defaultValue
;
function
getEnvVar
(
varName
:
string
):
string
{
const
value
=
process
.
env
[
varName
];
if
(
!
value
)
{
throw
new
Error
(
`Environment variable
${
varName
}
is not set`
);
}
return
value
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment