Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into native_voting_key_file
Browse files Browse the repository at this point in the history
# Conflicts:
#	presets/shared.yml
  • Loading branch information
fboucquez committed May 19, 2021
2 parents 0e1fad9 + 3e84560 commit 2500a78
Show file tree
Hide file tree
Showing 9 changed files with 473 additions and 16 deletions.
14 changes: 1 addition & 13 deletions config/rest-gateway/rest.json.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,7 @@
"allowedHosts": ["*"],
"allowedMethods": ["GET", "POST", "PUT", "OPTIONS"]
},
"extensions": [
"accountLink",
"aggregate",
"lockHash",
"lockSecret",
"mosaic",
"metadata",
"multisig",
"namespace",
"receipts",
"restrictions",
"transfer"
],
"extensions": {{{toJson (splitCsv restExtensions)}}},
"db": {
"url": "mongodb://{{{databaseHost}}}:27017/",
"name": "catapult",
Expand Down
3 changes: 2 additions & 1 deletion presets/shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ votingKeysDirectory: ./votingkeys
enableDelegatedHarvestersAutoDetection: true
catapultAppFolder: /usr/catapult
rewardProgramAgentPort: 7881
enableRevoteOnBoot: true

# config database
databaseName: catapult
Expand Down Expand Up @@ -211,4 +212,4 @@ maxConnectionAttempts: 15
baseRetryDelay: 750
connectionPoolSize: 10
maxSubscriptions: 300
enableRevoteOnBoot: true
restExtensions: 'accountLink, aggregate, lockHash, lockSecret, mosaic, metadata, multisig, namespace, receipts, restrictions, transfer, cmc'
18 changes: 17 additions & 1 deletion src/service/BootstrapUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,13 @@ export class BootstrapUtils {
if (isMustache) {
const template = await BootstrapUtils.readTextFile(fromPath);
const renderedTemplate = this.runTemplate(template, templateContext);
await fsPromises.writeFile(destinationFile, renderedTemplate);

await fsPromises.writeFile(
destinationFile,
destinationFile.toLowerCase().endsWith('.json')
? BootstrapUtils.formatJson(renderedTemplate)
: renderedTemplate,
);
} else {
await fsPromises.copyFile(fromPath, destinationFile);
}
Expand Down Expand Up @@ -614,6 +620,7 @@ export class BootstrapUtils {
Handlebars.registerHelper('toSimpleHex', BootstrapUtils.toSimpleHex);
Handlebars.registerHelper('toSeconds', BootstrapUtils.toSeconds);
Handlebars.registerHelper('toJson', BootstrapUtils.toJson);
Handlebars.registerHelper('splitCsv', BootstrapUtils.splitCsv);
Handlebars.registerHelper('add', BootstrapUtils.add);
Handlebars.registerHelper('minus', BootstrapUtils.minus);
Handlebars.registerHelper('computerMemory', BootstrapUtils.computerMemory);
Expand Down Expand Up @@ -664,6 +671,15 @@ export class BootstrapUtils {
return JSON.stringify(object, null, 2);
}

public static formatJson(string: string): string {
// Validates and format the json string.
return JSON.stringify(JSON.parse(string), null, 2);
}

public static splitCsv(object: string): string[] {
return (object || '').split(',').map((c) => c.trim());
}

public static toSeconds(serverDuration: string): number {
return DtoMapping.parseServerDuration(serverDuration).seconds();
}
Expand Down
87 changes: 87 additions & 0 deletions test/reports/bootstrap-voting/rest-gateway-0-rest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"network": {
"name": "publicTest",
"description": "catapult development network"
},
"port": 3000,
"crossDomain": {
"allowedHosts": [
"*"
],
"allowedMethods": [
"GET",
"POST",
"PUT",
"OPTIONS"
]
},
"extensions": [
"accountLink",
"aggregate",
"lockHash",
"lockSecret",
"mosaic",
"metadata",
"multisig",
"namespace",
"receipts",
"restrictions",
"transfer",
"cmc"
],
"db": {
"url": "mongodb://db-0:27017/",
"name": "catapult",
"pageSizeMin": 10,
"pageSizeMax": 100,
"maxConnectionAttempts": 15,
"baseRetryDelay": 750,
"connectionPoolSize": 10
},
"apiNode": {
"host": "api-node-0",
"port": 7900,
"tlsClientCertificatePath": "/symbol-workdir/api-node-config/cert/node.crt.pem",
"tlsClientKeyPath": "/symbol-workdir/api-node-config/cert/node.key.pem",
"tlsCaCertificatePath": "/symbol-workdir/api-node-config/cert/ca.cert.pem",
"timeout": 1000,
"networkPropertyFilePath": "/symbol-workdir/api-node-config/config-network.properties",
"nodePropertyFilePath": "/symbol-workdir/api-node-config/config-node.properties"
},
"websocket": {
"mq": {
"host": "api-node-broker-0",
"port": 7902,
"monitorInterval": 500,
"connectTimeout": 10000,
"monitorLoggingThrottle": 60000,
"maxSubscriptions": 300
},
"allowOptionalAddress": true
},
"throttling": {
"burst": 80,
"rate": 60
},
"logging": {
"console": {
"formats": [
"colorize",
"simple"
],
"level": "verbose",
"handleExceptions": true
},
"file": {
"formats": [
"prettyPrint"
],
"level": "verbose",
"handleExceptions": true,
"filename": "/symbol-workdir/logs/catapult-rest.log",
"maxsize": 20971520,
"maxFiles": 100
}
},
"numBlocksTransactionFeeStats": 300
}
87 changes: 87 additions & 0 deletions test/reports/mainnet-dual-voting/rest-gateway-rest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"network": {
"name": "public",
"description": "catapult public main network"
},
"port": 3000,
"crossDomain": {
"allowedHosts": [
"*"
],
"allowedMethods": [
"GET",
"POST",
"PUT",
"OPTIONS"
]
},
"extensions": [
"accountLink",
"aggregate",
"lockHash",
"lockSecret",
"mosaic",
"metadata",
"multisig",
"namespace",
"receipts",
"restrictions",
"transfer",
"cmc"
],
"db": {
"url": "mongodb://db:27017/",
"name": "catapult",
"pageSizeMin": 10,
"pageSizeMax": 100,
"maxConnectionAttempts": 15,
"baseRetryDelay": 750,
"connectionPoolSize": 10
},
"apiNode": {
"host": "node",
"port": 7900,
"tlsClientCertificatePath": "/symbol-workdir/api-node-config/cert/node.crt.pem",
"tlsClientKeyPath": "/symbol-workdir/api-node-config/cert/node.key.pem",
"tlsCaCertificatePath": "/symbol-workdir/api-node-config/cert/ca.cert.pem",
"timeout": 1000,
"networkPropertyFilePath": "/symbol-workdir/api-node-config/config-network.properties",
"nodePropertyFilePath": "/symbol-workdir/api-node-config/config-node.properties"
},
"websocket": {
"mq": {
"host": "broker",
"port": 7902,
"monitorInterval": 500,
"connectTimeout": 10000,
"monitorLoggingThrottle": 60000,
"maxSubscriptions": 300
},
"allowOptionalAddress": true
},
"throttling": {
"burst": 80,
"rate": 60
},
"logging": {
"console": {
"formats": [
"colorize",
"simple"
],
"level": "verbose",
"handleExceptions": true
},
"file": {
"formats": [
"prettyPrint"
],
"level": "verbose",
"handleExceptions": true,
"filename": "/symbol-workdir/logs/catapult-rest.log",
"maxsize": 20971520,
"maxFiles": 100
}
},
"numBlocksTransactionFeeStats": 300
}
87 changes: 87 additions & 0 deletions test/reports/mainnet-dual/rest-gateway-rest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"network": {
"name": "public",
"description": "catapult public main network"
},
"port": 3000,
"crossDomain": {
"allowedHosts": [
"*"
],
"allowedMethods": [
"GET",
"POST",
"PUT",
"OPTIONS"
]
},
"extensions": [
"accountLink",
"aggregate",
"lockHash",
"lockSecret",
"mosaic",
"metadata",
"multisig",
"namespace",
"receipts",
"restrictions",
"transfer",
"cmc"
],
"db": {
"url": "mongodb://db:27017/",
"name": "catapult",
"pageSizeMin": 10,
"pageSizeMax": 100,
"maxConnectionAttempts": 15,
"baseRetryDelay": 750,
"connectionPoolSize": 10
},
"apiNode": {
"host": "node",
"port": 7900,
"tlsClientCertificatePath": "/symbol-workdir/api-node-config/cert/node.crt.pem",
"tlsClientKeyPath": "/symbol-workdir/api-node-config/cert/node.key.pem",
"tlsCaCertificatePath": "/symbol-workdir/api-node-config/cert/ca.cert.pem",
"timeout": 1000,
"networkPropertyFilePath": "/symbol-workdir/api-node-config/config-network.properties",
"nodePropertyFilePath": "/symbol-workdir/api-node-config/config-node.properties"
},
"websocket": {
"mq": {
"host": "broker",
"port": 7902,
"monitorInterval": 500,
"connectTimeout": 10000,
"monitorLoggingThrottle": 60000,
"maxSubscriptions": 300
},
"allowOptionalAddress": true
},
"throttling": {
"burst": 80,
"rate": 60
},
"logging": {
"console": {
"formats": [
"colorize",
"simple"
],
"level": "verbose",
"handleExceptions": true
},
"file": {
"formats": [
"prettyPrint"
],
"level": "verbose",
"handleExceptions": true,
"filename": "/symbol-workdir/logs/catapult-rest.log",
"maxsize": 20971520,
"maxFiles": 100
}
},
"numBlocksTransactionFeeStats": 300
}
Loading

0 comments on commit 2500a78

Please sign in to comment.