How to use the @hyperledger/caliper-core.ConfigUtil.keys function in @hyperledger/caliper-core

To help you get started, we’ve selected a few @hyperledger/caliper-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / caliper / packages / caliper-cli / lib / benchmark / lib / runBenchmark.js View on Github external
static async handler(argv) {
        let workspacePath = ConfigUtil.get(ConfigUtil.keys.Workspace);
        let benchmarkConfigPath = ConfigUtil.get(ConfigUtil.keys.BenchConfig);
        let networkConfigPath = ConfigUtil.get(ConfigUtil.keys.NetworkConfig);

        // Workspace is expected to be the root location of working folders
        workspacePath = path.resolve(workspacePath);
        benchmarkConfigPath = CaliperUtils.resolvePath(benchmarkConfigPath, workspacePath);
        networkConfigPath = CaliperUtils.resolvePath(networkConfigPath, workspacePath);

        if(!benchmarkConfigPath || !fs.existsSync(benchmarkConfigPath)) {
            let msg = `Benchmark configuration file "${benchmarkConfigPath || 'UNSET'}" does not exist`;
            logger.error(msg);
            throw new Error(msg);
        }

        if(!networkConfigPath || !fs.existsSync(networkConfigPath)) {
            let msg = `Network configuration file "${networkConfigPath || 'UNSET'}" does not exist`;
            logger.error(msg);
github hyperledger / caliper / packages / caliper-cli / lib / zooclient / lib / startZooClient.js View on Github external
static async handler(argv) {
        let blockchainConfigFile = ConfigUtil.get(ConfigUtil.keys.NetworkConfig, undefined);
        let workspace = ConfigUtil.get(ConfigUtil.keys.Workspace, './');

        // Workspace is expected to be the root location of working folders
        workspace = path.resolve(workspace);
        blockchainConfigFile = path.isAbsolute(blockchainConfigFile) ? blockchainConfigFile : path.join(workspace, blockchainConfigFile);

        if(!blockchainConfigFile || !fs.existsSync(blockchainConfigFile)) {
            throw(new Error(`Network configuration file "${blockchainConfigFile || 'UNSET'}" does not exist`));
        }

        let blockchainType = '';
        let networkObject = CaliperUtils.parseYaml(blockchainConfigFile);
        if (networkObject.hasOwnProperty('caliper') && networkObject.caliper.hasOwnProperty('blockchain')) {
            blockchainType = networkObject.caliper.blockchain;
        } else {
            throw new Error('The configuration file [' + blockchainConfigFile + '] is missing its "caliper.blockchain" attribute');
github hyperledger / caliper / packages / caliper-fabric / lib / fabric.js View on Github external
this.clientProfiles = new Map();
        this.adminProfiles = new Map();
        this.registrarProfiles = new Map();
        this.eventSources = [];
        this.clientIndex = 0;
        this.txIndex = -1;
        this.randomTargetPeerCache = new Map();
        this.channelEventSourcesCache = new Map();
        this.randomTargetOrdererCache = new Map();
        this.wallet = undefined;
        this.userContracts = new Map();

        // this value is hardcoded, if it's used, that means that the provided timeouts are not sufficient
        this.configSmallestTimeout = 1000;

        this.configSleepAfterCreateChannel = ConfigUtil.get(ConfigUtil.keys.Fabric.SleepAfter.CreateChannel, 5000);
        this.configSleepAfterJoinChannel = ConfigUtil.get(ConfigUtil.keys.Fabric.SleepAfter.JoinChannel, 3000);
        this.configSleepAfterInstantiateChaincode = ConfigUtil.get(ConfigUtil.keys.Fabric.SleepAfter.InstantiateChaincode, 5000);
        this.configVerifyProposalResponse = ConfigUtil.get(ConfigUtil.keys.Fabric.Verify.ProposalResponse, true);
        this.configVerifyReadWriteSets = ConfigUtil.get(ConfigUtil.keys.Fabric.Verify.ReadWriteSets, true);
        this.configLatencyThreshold = ConfigUtil.get(ConfigUtil.keys.Fabric.LatencyThreshold, 1.0);
        this.configOverwriteGopath = ConfigUtil.get(ConfigUtil.keys.Fabric.OverwriteGopath, true);
        this.configChaincodeInstantiateTimeout = ConfigUtil.get(ConfigUtil.keys.Fabric.Timeout.ChaincodeInstantiate, 300000);
        this.configChaincodeInstantiateEventTimeout = ConfigUtil.get(ConfigUtil.keys.Fabric.Timeout.ChaincodeInstantiateEvent, 300000);
        this.configDefaultTimeout = ConfigUtil.get(ConfigUtil.keys.Fabric.Timeout.InvokeOrQuery, 60000);
        this.configClientBasedLoadBalancing = ConfigUtil.get(ConfigUtil.keys.Fabric.LoadBalancing, 'client') === 'client';
        this.configCountQueryAsLoad = ConfigUtil.get(ConfigUtil.keys.Fabric.CountQueryAsLoad, true);
        this.configUseGateway = ConfigUtil.get(ConfigUtil.keys.Fabric.Gateway, false);
        this.configLocalHost = ConfigUtil.get(ConfigUtil.keys.Fabric.GatewayLocalHost, true);
        this.configDiscovery = ConfigUtil.get(ConfigUtil.keys.Fabric.Discovery, false);

        ConfigValidator.validateNetwork(this.network, CaliperUtils.getFlowOptions(),
github hyperledger / caliper / packages / caliper-cli / lib / benchmark / lib / runBenchmark.js View on Github external
static async handler(argv) {
        let workspacePath = ConfigUtil.get(ConfigUtil.keys.Workspace);
        let benchmarkConfigPath = ConfigUtil.get(ConfigUtil.keys.BenchConfig);
        let networkConfigPath = ConfigUtil.get(ConfigUtil.keys.NetworkConfig);

        // Workspace is expected to be the root location of working folders
        workspacePath = path.resolve(workspacePath);
        benchmarkConfigPath = CaliperUtils.resolvePath(benchmarkConfigPath, workspacePath);
        networkConfigPath = CaliperUtils.resolvePath(networkConfigPath, workspacePath);

        if(!benchmarkConfigPath || !fs.existsSync(benchmarkConfigPath)) {
            let msg = `Benchmark configuration file "${benchmarkConfigPath || 'UNSET'}" does not exist`;
            logger.error(msg);
            throw new Error(msg);
        }

        if(!networkConfigPath || !fs.existsSync(networkConfigPath)) {
            let msg = `Network configuration file "${networkConfigPath || 'UNSET'}" does not exist`;
github hyperledger / caliper / packages / caliper-cli / lib / zooclient / lib / startZooClient.js View on Github external
static async handler(argv) {
        let blockchainConfigFile = ConfigUtil.get(ConfigUtil.keys.NetworkConfig, undefined);
        let workspace = ConfigUtil.get(ConfigUtil.keys.Workspace, './');

        // Workspace is expected to be the root location of working folders
        workspace = path.resolve(workspace);
        blockchainConfigFile = path.isAbsolute(blockchainConfigFile) ? blockchainConfigFile : path.join(workspace, blockchainConfigFile);

        if(!blockchainConfigFile || !fs.existsSync(blockchainConfigFile)) {
            throw(new Error(`Network configuration file "${blockchainConfigFile || 'UNSET'}" does not exist`));
        }

        let blockchainType = '';
        let networkObject = CaliperUtils.parseYaml(blockchainConfigFile);
        if (networkObject.hasOwnProperty('caliper') && networkObject.caliper.hasOwnProperty('blockchain')) {
            blockchainType = networkObject.caliper.blockchain;
        } else {
            throw new Error('The configuration file [' + blockchainConfigFile + '] is missing its "caliper.blockchain" attribute');
        }
github hyperledger / caliper / packages / caliper-cli / lib / zooservice / lib / stopZooService.js View on Github external
static async handler(argv) {
        let cmd = 'docker-compose -f ';
        if (ConfigUtil.get(ConfigUtil.keys.ZooConfig, undefined)){
            cmd += argv.config + ' down';
        } else {
            cmdUtil.log(chalk.blue.bold('Using default configuration file'));
            cmd += __dirname + '/zookeeper-service.yaml down';
        }

        cmdUtil.log(chalk.blue.bold('Stopping zookeeper service ......'));
        await StopZooService.execAsync(cmd);
        cmdUtil.log(chalk.blue.bold('Stop zookeeper service successful'));
    }
github hyperledger / caliper / packages / caliper-cli / lib / bind / bind.js View on Github external
static async handler(argv) {
        let sut = ConfigUtil.get(ConfigUtil.keys.Bind.Sut, undefined);
        let sdk = ConfigUtil.get(ConfigUtil.keys.Bind.Sdk, undefined);
        let cwd = ConfigUtil.get(ConfigUtil.keys.Bind.Cwd, undefined);
        let userArgs = ConfigUtil.get(ConfigUtil.keys.Bind.Args, undefined);

        let bindOptions = CaliperUtils.parseYaml(path.join(__dirname, './config.yaml'));

        let sutList = Object.keys(bindOptions.sut);
        if (!sut) {
            let msg = `SUT name is not specified. Available SUTs: ${sutList.join(' | ')}`;
            logger.error(msg);
            throw new Error(msg);
        }

        if (!sutList.includes(sut)) {
            let msg = `Unknown SUT name "${sut}". Available SUTs: ${sutList.join(' | ')}`;
            logger.error(msg);
            throw new Error(msg);
        }
github hyperledger / caliper / packages / caliper-cli / lib / zooservice / lib / startZooService.js View on Github external
static async handler(argv) {
        let cmd = 'docker-compose -f ';
        if (ConfigUtil.get(ConfigUtil.keys.ZooConfig, undefined)){
            cmd += argv.config + ' up';
        } else {
            cmdUtil.log(chalk.blue.bold('Using default configuration file'));
            cmd += __dirname + '/zookeeper-service.yaml up';
        }

        cmdUtil.log(chalk.blue.bold('Starting zookeeper service ......'));
        await StartZooService.execAsync(cmd);
        cmdUtil.log(chalk.blue.bold('Start zookeeper service successful'));
    }
github hyperledger / caliper / packages / caliper-cli / lib / bind / bind.js View on Github external
static async handler(argv) {
        let sut = ConfigUtil.get(ConfigUtil.keys.Bind.Sut, undefined);
        let sdk = ConfigUtil.get(ConfigUtil.keys.Bind.Sdk, undefined);
        let cwd = ConfigUtil.get(ConfigUtil.keys.Bind.Cwd, undefined);
        let userArgs = ConfigUtil.get(ConfigUtil.keys.Bind.Args, undefined);

        let bindOptions = CaliperUtils.parseYaml(path.join(__dirname, './config.yaml'));

        let sutList = Object.keys(bindOptions.sut);
        if (!sut) {
            let msg = `SUT name is not specified. Available SUTs: ${sutList.join(' | ')}`;
            logger.error(msg);
            throw new Error(msg);
        }

        if (!sutList.includes(sut)) {
            let msg = `Unknown SUT name "${sut}". Available SUTs: ${sutList.join(' | ')}`;
            logger.error(msg);