Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof network === 'undefined') {
console.error('No network is provided');
process.exit(1);
}
// TODO: Default config is not accessible this way right now
// Will be fixed with https://github.com/LiskHQ/lisk/issues/3171
const appConfig = {
app: {
version: packageJSON.version,
minVersion: packageJSON.lisk.minVersion,
protocolVersion: packageJSON.lisk.protocolVersion,
},
};
configurator.loadConfig(appConfig);
const defaultConfig = configurator.getConfig({}, { failOnInvalidArg: false });
const networkConfig = loadJSONFileIfExists(
path.resolve(rootPath, `config/${network}/config.json`)
);
const unifiedNewConfig = _.merge({}, defaultConfig, networkConfig);
const userConfig = loadJSONFileIfExists(configFilePath);
const history = new JSONHistory('lisk config file', console);
const moveElement = (config, pathFrom, pathTo) => {
config = _.set(config, pathTo, _.get(config, pathFrom));
config = _.omit(config, pathFrom);
return config;
};
if (typeof network === 'undefined') {
console.error('No network is provided');
process.exit(1);
}
// TODO: Default config is not accessible this way right now
// Will be fixed with https://github.com/LiskHQ/lisk/issues/3171
const appConfig = {
app: {
version: packageJSON.version,
minVersion: packageJSON.lisk.minVersion,
protocolVersion: packageJSON.lisk.protocolVersion,
},
};
configurator.loadConfig(appConfig);
const defaultConfig = configurator.getConfig({}, { failOnInvalidArg: false });
const networkConfig = loadJSONFileIfExists(
path.resolve(rootPath, `config/${network}/config.json`)
);
const unifiedNewConfig = _.merge({}, defaultConfig, networkConfig);
const userConfig = loadJSONFileIfExists(configFilePath);
const history = new JSONHistory('lisk config file', console);
const moveElement = (config, pathFrom, pathTo) => {
config = _.set(config, pathTo, _.get(config, pathFrom));
config = _.omit(config, pathFrom);
return config;
configurator.loadConfig(appConfig);
const { NETWORK, CUSTOM_CONFIG_FILE } = configurator.getConfig();
// Variable is used to identify different networks on NewRelic
process.env.LISK_NETWORK = NETWORK;
configurator.loadConfigFile(
path.resolve(__dirname, `../../config/${NETWORK}/config`)
);
if (CUSTOM_CONFIG_FILE) {
configurator.loadConfigFile(path.resolve(CUSTOM_CONFIG_FILE));
}
const config = configurator.getConfig();
// To run multiple applications for same network for integration tests
config.app.label = `lisk-${NETWORK}-${config.modules.http_api.httpPort}`;
export { config };
version: packageJSON.version,
minVersion: packageJSON.lisk.minVersion,
protocolVersion: packageJSON.lisk.protocolVersion,
lastCommitId,
buildVersion,
},
};
// Support for PROTOCOL_VERSION only for tests
if (process.env.NODE_ENV === 'test' && process.env.PROTOCOL_VERSION) {
appConfig.app.protocolVersion = process.env.PROTOCOL_VERSION;
}
configurator.loadConfig(appConfig);
const { NETWORK, CUSTOM_CONFIG_FILE } = configurator.getConfig();
// Variable is used to identify different networks on NewRelic
process.env.LISK_NETWORK = NETWORK;
configurator.loadConfigFile(
path.resolve(__dirname, `../../config/${NETWORK}/config`)
);
if (CUSTOM_CONFIG_FILE) {
configurator.loadConfigFile(path.resolve(CUSTOM_CONFIG_FILE));
}
const config = configurator.getConfig();
// To run multiple applications for same network for integration tests
config.app.label = `lisk-${NETWORK}-${config.modules.http_api.httpPort}`;
const appConfig = {
app: {
version: packageJSON.version,
minVersion: packageJSON.lisk.minVersion,
protocolVersion: packageJSON.lisk.protocolVersion,
lastCommitId,
buildVersion,
},
};
// Support for PROTOCOL_VERSION only for tests
if (process.env.NODE_ENV === 'test' && process.env.PROTOCOL_VERSION) {
appConfig.app.protocolVersion = process.env.PROTOCOL_VERSION;
}
configurator.loadConfig(appConfig);
const { NETWORK, CUSTOM_CONFIG_FILE } = configurator.getConfig();
// Variable is used to identify different networks on NewRelic
process.env.LISK_NETWORK = NETWORK;
configurator.loadConfigFile(
path.resolve(__dirname, `../../config/${NETWORK}/config`)
);
if (CUSTOM_CONFIG_FILE) {
configurator.loadConfigFile(path.resolve(CUSTOM_CONFIG_FILE));
}
const config = configurator.getConfig();
},
};
// Support for PROTOCOL_VERSION only for tests
if (process.env.NODE_ENV === 'test' && process.env.PROTOCOL_VERSION) {
appConfig.app.protocolVersion = process.env.PROTOCOL_VERSION;
}
configurator.loadConfig(appConfig);
const { NETWORK, CUSTOM_CONFIG_FILE } = configurator.getConfig();
// Variable is used to identify different networks on NewRelic
process.env.LISK_NETWORK = NETWORK;
configurator.loadConfigFile(
path.resolve(__dirname, `../../config/${NETWORK}/config`)
);
if (CUSTOM_CONFIG_FILE) {
configurator.loadConfigFile(path.resolve(CUSTOM_CONFIG_FILE));
}
const config = configurator.getConfig();
// To run multiple applications for same network for integration tests
config.app.label = `lisk-${NETWORK}-${config.modules.http_api.httpPort}`;
export { config };
},
CUSTOM_CONFIG_FILE: {
type: ['string', 'null'],
description: 'Custom configuration file path',
default: null,
env: 'LISK_CONFIG_FILE',
arg: '--config,-c',
},
},
default: {
NETWORK: 'devnet',
CUSTOM_CONFIG_FILE: null,
},
};
configurator.registerSchema(appSchema);
const appConfig = {
app: {
version: packageJSON.version,
minVersion: packageJSON.lisk.minVersion,
protocolVersion: packageJSON.lisk.protocolVersion,
lastCommitId,
buildVersion,
},
};
// Support for PROTOCOL_VERSION only for tests
if (process.env.NODE_ENV === 'test' && process.env.PROTOCOL_VERSION) {
appConfig.app.protocolVersion = process.env.PROTOCOL_VERSION;
}
this.chainSymbols.map(async (chainSymbol) => {
let chainOptions = this.options.chains[chainSymbol];
let storageConfig = {
...storageConfigOptions,
database: chainOptions.database,
};
let storage = createStorageComponent(storageConfig, this.logger);
await storage.bootstrap();
storageComponents[chainSymbol] = storage;
// TODO: When it becomes possible, use internal module API (using channel.invoke) to get this data instead of direct DB access.
let multisigMemberRows = await storage.adapter.db.query(
'select mem_accounts2multisignatures."dependentId" from mem_accounts2multisignatures where mem_accounts2multisignatures."accountId" = $1',
[chainOptions.walletAddress],
);
multisigMemberRows.forEach((row) => {
this.multisigWalletInfo[chainSymbol].members[row.dependentId] = true;
});
this.multisigWalletInfo[chainSymbol].memberCount = multisigMemberRows.length;
let multisigMemberMinSigRows = await storage.adapter.db.query(
'select multimin from mem_accounts where address = $1',
this.logger.error(
`Failed to process ${chainOptions.moduleAlias}:postTransaction action - ${postTxnResult.message}`
);
}
}
}
}
return;
}
});
let loggerConfig = await channel.invoke(
'app:getComponentConfig',
'logger',
);
this.logger = createLoggerComponent({...loggerConfig, ...this.options.logger});
try {
await mkdir(this.options.orderBookSnapshotBackupDirPath);
} catch (error) {
if (error.code !== 'EEXIST') {
this.logger.error(
`Failed to create snapshot directory ${
this.options.orderBookSnapshotBackupDirPath
} because of error: ${
error.message
}`
);
}
}
try {