def Main(): import pdo.common.config as pconfig import pdo.common.logger as plogger # parse out the configuration file first conffiles = ['pcontract.toml'] confpaths = [".", "./etc", ContractEtc] parser = argparse.ArgumentParser(allow_abbrev=False) parser.add_argument('--config', help='configuration file', nargs='+') parser.add_argument( '--config-dir', help='directories to search for the configuration file', nargs='+') parser.add_argument('-i', '--identity', help='Identity to use for the process', type=str) parser.add_argument( '--logfile', help='Name of the log file, __screen__ for standard output', type=str) parser.add_argument('--loglevel', help='Logging level', type=str) parser.add_argument('--ledger', help='URL for the Sawtooth ledger', type=str) parser.add_argument('--data-dir', help='Directory for storing generated files', type=str) parser.add_argument('--source-dir', help='Directories to search for contract source', nargs='+', type=str) parser.add_argument('--key-dir', help='Directories to search for key files', nargs='+') parser.add_argument('--eservice-db', help='json file for eservice database', type=str) parser.add_argument('-m', '--mapvar', help='Define variables for script use', nargs=2, action='append') options, script = parser.parse_known_args() # first process the options necessary to load the default configuration if options.config: conffiles = options.config if options.config_dir: confpaths = options.config_dir global config_map config_map['identity'] = '__unknown__' if options.identity: config_map['identity'] = options.identity if options.data_dir: config_map['data'] = options.data_dir ContractData = options.data_dir try: config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e: logger.error(str(e)) sys.exit(-1) # set up the logging configuration if config.get('Logging') is None: config['Logging'] = {'LogFile': '__screen__', 'LogLevel': 'WARN'} if options.logfile: config['Logging']['LogFile'] = options.logfile if options.loglevel: config['Logging']['LogLevel'] = options.loglevel.upper() plogger.setup_loggers(config.get('Logging', {})) # set up the ledger configuration if config.get('Sawtooth') is None: config['Sawtooth'] = { 'LedgerURL': 'http://localhost:8008', } if options.ledger: config['Sawtooth']['LedgerURL'] = options.ledger # set up the key search paths if config.get('Key') is None: config['Key'] = { 'SearchPath': ['.', './keys', ContractKeys], 'FileName': options.identity + ".pem" } if options.key_dir: config['Key']['SearchPath'] = options.key_dir # set up the service configuration if config.get('Service') is None: config['Service'] = { 'EnclaveServiceDatabaseFile': os.path.join(ContractData, 'eservice_db.json') } if options.eservice_db: config['Service']['EnclaveServiceDatabaseFile'] = options.eservice_db # set up the data paths if config.get('Contract') is None: config['Contract'] = { 'DataDirectory': ContractData, 'SourceSearchPath': [".", "./contract", os.path.join(ContractHome, 'contracts')] } if options.data_dir: config['Contract']['DataDirectory'] = options.data_dir if options.source_dir: config['Contract']['SourceSearchPath'] = options.source_dir putils.set_default_data_directory(config['Contract']['DataDirectory']) if script: config["ScriptFile"] = script.pop(0) varmap = config.get("Bindings", {}) while script: try: key = script.pop(0) val = script.pop(0) except ValueError: logger.error('unable to process script arguments') sys.exit(1) key = key.lstrip('-') varmap[key] = val config["Bindings"] = varmap # this sets the initial bindings available in the script if options.mapvar: varmap = config.get("Bindings", {}) for (k, v) in options.mapvar: varmap[k] = v config["Bindings"] = varmap # GO! LocalMain(config)
def Main(): global use_ledger global use_eservice global use_pservice import pdo.common.config as pconfig import pdo.common.logger as plogger # parse out the configuration file first conffiles = ['pcontract.toml', 'enclave.toml'] confpaths = [".", "./etc", ContractEtc] parser = argparse.ArgumentParser() parser.add_argument('--config', help='configuration file', nargs='+') parser.add_argument( '--config-dir', help='directories to search for the configuration file', nargs='+') parser.add_argument('-i', '--identity', help='Identity to use for the process', type=str) parser.add_argument( '--logfile', help='Name of the log file, __screen__ for standard output', type=str) parser.add_argument('--loglevel', help='Logging level', type=str) parser.add_argument('--ledger', help='URL for the Sawtooth ledger', type=str) parser.add_argument('--no-ledger', help='Do not attempt ledger registration', action="store_true") parser.add_argument('--data-dir', help='Directory for storing generated files', type=str) parser.add_argument('--source-dir', help='Directories to search for contract source', nargs='+', type=str) parser.add_argument('--key-dir', help='Directories to search for key files', nargs='+') parser.add_argument('--eservice-url', help='List of enclave service URLs to use', nargs='+') parser.add_argument('--pservice-url', help='List of provisioning service URLs to use', nargs='+') parser.add_argument('--secret-count', help='Number of secrets to generate', type=int, default=3) parser.add_argument('--iterations', help='Number of operations to perform', type=int, default=10) options = parser.parse_args() # first process the options necessary to load the default configuration if options.config: conffiles = options.config if options.config_dir: confpaths = options.config_dir # customize the configuration file for the current request global config_map config_map['identity'] = 'test-request' if options.identity: config_map['identity'] = options.identity if options.data_dir: config_map['data'] = options.data_dir config_map['contract'] = 'mock-contract' # parse the configuration file try: config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e: logger.error(str(e)) sys.exit(-1) # set up the logging configuration if config.get('Logging') is None: config['Logging'] = {'LogFile': '__screen__', 'LogLevel': 'INFO'} if options.logfile: config['Logging']['LogFile'] = options.logfile if options.loglevel: config['Logging']['LogLevel'] = options.loglevel.upper() plogger.setup_loggers(config.get('Logging', {})) sys.stdout = plogger.stream_to_logger(logging.getLogger('STDOUT'), logging.DEBUG) sys.stderr = plogger.stream_to_logger(logging.getLogger('STDERR'), logging.WARN) # set up the ledger configuration if config.get('Sawtooth') is None: config['Sawtooth'] = { 'LedgerURL': 'http://localhost:8008', } if options.ledger: config['Sawtooth']['LedgerURL'] = options.ledger # set up the key search paths if config.get('Key') is None: config['Key'] = { 'SearchPath': ['.', './keys', ContractKeys], 'FileName': options.identity + ".pem" } if options.key_dir: config['Key']['SearchPath'] = options.key_dir # set up the service configuration if config.get('Service') is None: config['Service'] = { 'EnclaveServiceURLs': [], 'ProvisioningServiceURLs': [] } if options.eservice_url: use_eservice = True config['Service']['EnclaveServiceURLs'] = options.eservice_url if options.pservice_url: use_pservice = True config['Service']['ProvisioningServiceURLs'] = options.pservice_url # set up the data paths if config.get('Contract') is None: config['Contract'] = { 'DataDirectory': ContractData, 'SourceSearchPath': [".", "./contract", os.path.join(ContractHome, 'contracts')] } if options.data_dir: config['Contract']['DataDirectory'] = options.data_dir if options.source_dir: config['Contract']['SourceSearchPath'] = options.source_dir putils.set_default_data_directory(config['Contract']['DataDirectory']) if options.no_ledger or not config['Sawtooth']['LedgerURL']: use_ledger = False config.pop('Sawtooth', None) config['secrets'] = options.secret_count config['iterations'] = options.iterations LocalMain(config)
def Main(): global use_ledger global use_eservice global use_pservice # parse out the configuration file first conffiles = ['pcontract.toml', 'enclave.toml'] confpaths = [".", "./etc", ContractEtc] parser = argparse.ArgumentParser() parser.add_argument('--config', help='configuration file', nargs='+') parser.add_argument( '--config-dir', help='directories to search for the configuration file', nargs='+') parser.add_argument('-i', '--identity', help='Identity to use for the process', default='test-request', type=str) parser.add_argument( '--logfile', help='Name of the log file, __screen__ for standard output', type=str) parser.add_argument('--loglevel', help='Logging level', type=str) parser.add_argument('--ledger', help='URL for the Sawtooth ledger', type=str) parser.add_argument('--no-ledger', help='Do not attempt ledger registration', action="store_true") parser.add_argument('--data-dir', help='Directory for storing generated files', type=str) parser.add_argument('--source-dir', help='Directories to search for contract source', nargs='+', type=str) parser.add_argument('--key-dir', help='Directories to search for key files', nargs='+') parser.add_argument('--eservice-url', help='List of enclave service URLs to use', nargs='+') parser.add_argument('--randomize-eservice', help="Randomize eservice used for each update", action="store_true") parser.add_argument('--pservice-url', help='List of provisioning service URLs to use', nargs='+') parser.add_argument('--block-store', help='Name of the file where blocks are stored', type=str) parser.add_argument('--secret-count', help='Number of secrets to generate', type=int, default=3) parser.add_argument('--contract', help='Name of the contract to use', default='mock-contract') parser.add_argument('--interpreter', help='Name of the contract to to require', default=ContractInterpreter) parser.add_argument('--expressions', help='Name of a file to read for expressions', default=None) parser.add_argument( '--num-provable-replicas', help='Number of sservice signatures needed for proof of replication', type=int, default=1) parser.add_argument( '--availability-duration', help= 'duration (in seconds) for which the replicas are stored at storage service', type=int, default=60) options = parser.parse_args() # first process the options necessary to load the default configuration if options.config: conffiles = options.config if options.config_dir: confpaths = options.config_dir # customize the configuration file for the current request global config_map config_map['identity'] = options.identity if options.data_dir: config_map['data'] = options.data_dir config_map['contract'] = options.contract # parse the configuration file try: config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e: logger.error(str(e)) sys.exit(-1) # set up the logging configuration if config.get('Logging') is None: config['Logging'] = {'LogFile': '__screen__', 'LogLevel': 'INFO'} if options.logfile: config['Logging']['LogFile'] = options.logfile if options.loglevel: config['Logging']['LogLevel'] = options.loglevel.upper() plogger.setup_loggers(config.get('Logging', {})) sys.stdout = plogger.stream_to_logger(logging.getLogger('STDOUT'), logging.DEBUG) sys.stderr = plogger.stream_to_logger(logging.getLogger('STDERR'), logging.WARN) # set up the ledger configuration if config.get('Sawtooth') is None: config['Sawtooth'] = { 'LedgerURL': 'http://localhost:8008', } if options.ledger: config['Sawtooth']['LedgerURL'] = options.ledger if options.no_ledger or not config['Sawtooth']['LedgerURL']: use_ledger = False config.pop('Sawtooth', None) # set up the key search paths if config.get('Key') is None: config['Key'] = { 'SearchPath': ['.', './keys', ContractKeys], 'FileName': options.identity + ".pem" } if options.key_dir: config['Key']['SearchPath'] = options.key_dir # set up the service configuration if config.get('Service') is None: config['Service'] = { 'EnclaveServiceURLs': [], 'ProvisioningServiceURLs': [], 'EnclaveServiceDatabaseFile': None, 'Randomize_Eservice': False } if options.randomize_eservice: config['Service']['Randomize_Eservice'] = True else: config['Service']['Randomize_Eservice'] = False if options.eservice_url: use_eservice = True config['Service']['EnclaveServiceURLs'] = options.eservice_url if options.pservice_url: use_pservice = True config['Service']['ProvisioningServiceURLs'] = options.pservice_url # replication parameters if options.num_provable_replicas: config['Replication'][ 'NumProvableReplicas'] = options.num_provable_replicas if options.availability_duration: config['Replication']['Duration'] = options.availability_duration # set up the data paths if config.get('Contract') is None: config['Contract'] = { 'DataDirectory': ContractData, 'SourceSearchPath': [".", "./contract", os.path.join(ContractHome, 'contracts')] } if config['Contract'].get('Name') is None: config['Contract']['Name'] = options.contract config['Contract']['SourceFile'] = '_{0}'.format(options.contract) config['Contract']['Interpreter'] = options.interpreter if options.data_dir: config['Contract']['DataDirectory'] = options.data_dir if options.source_dir: config['Contract']['SourceSearchPath'] = options.source_dir putils.set_default_data_directory(config['Contract']['DataDirectory']) # set up the storage service configuration if config.get('StorageService') is None: config['StorageService'] = { 'BlockStore': os.path.join(config['Contract']['DataDirectory'], options.identity + '.mdb'), } if options.block_store: config['StorageService']['BlockStore'] = options.block_store config['secrets'] = options.secret_count if options.expressions: expression_file = options.expressions else: expression_file = putils.build_simple_file_name( options.contract, '.exp') try: config['expressions'] = putils.find_file_in_path( expression_file, ['.', '..', 'tests']) except FileNotFoundError as fe: logger.error('unable to locate expression file "%s"', expression_file) sys.exit(-1) LocalMain(config)
def Main(): import pdo.common.config as pconfig import pdo.common.logger as plogger # parse out the configuration file first conffiles = ['auction-test.toml'] confpaths = [".", "./etc", ContractEtc] parser = argparse.ArgumentParser() parser.add_argument('--config', help='configuration file', nargs='+') parser.add_argument('--config-dir', help='configuration file', nargs='+') parser.add_argument( '--logfile', help='Name of the log file, __screen__ for standard output', type=str) parser.add_argument('--loglevel', help='Logging level', type=str) parser.add_argument('--ledger', help='URL for the Sawtooth ledger', type=str) parser.add_argument('--asset-contract', help='Name of the asset contract', default="integer-key", type=str) parser.add_argument('--asset-identity', help='Identity to use for the asset contract', default="ikey-contract", type=str) parser.add_argument('--auction-contract', help='Name of the auction contract', default="integer-key-auction", type=str) parser.add_argument('--auction-identity', help='Identity to use for the auction contract', default="auc-contract", type=str) parser.add_argument('--key-dir', help='Directories to search for key files', nargs='+') parser.add_argument('--data-dir', help='Path for storing generated files', type=str) parser.add_argument('--source-dir', help='Directories to search for contract source', nargs='+', type=str) options = parser.parse_args() # first process the options necessary to load the default configuration if options.config: conffiles = options.config if options.config_dir: confpaths = options.config_dir global config_map config_map['assetidentity'] = options.asset_identity config_map['assetcontract'] = options.asset_contract config_map['auctionidentity'] = options.auction_identity config_map['auctioncontract'] = options.auction_contract if options.data_dir: config_map['data'] = options.data_dir try: config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e: logger.error(str(e)) sys.exit(-1) # set up the logging configuration if config.get('Logging') is None: config['Logging'] = {'LogFile': '__screen__', 'LogLevel': 'INFO'} if options.logfile: config['Logging']['LogFile'] = options.logfile if options.loglevel: config['Logging']['LogLevel'] = options.loglevel.upper() plogger.setup_loggers(config.get('Logging', {})) # set up the ledger configuration if config.get('Sawtooth') is None: config['Sawtooth'] = { 'LedgerURL': 'http://localhost:8008', } if options.ledger: config['Sawtooth']['LedgerURL'] = options.ledger # set up the key search paths if config.get('Key') is None: config['Key'] = {'SearchPath': ['.', './keys', ContractKeys]} if options.key_dir: config['Key']['SearchPath'] = options.key_dir # set up the data paths if config.get('Contract') is None: config['Contract'] = { 'SourceSearchPath': ['.', './contract', os.path.join(ContractHome, 'contracts')] } if options.data_dir: config['Contract']['DataDirectory'] = options.data_dir if options.source_dir: config['Contract']['SourceSearchPath'] = options.source_dir putils.set_default_data_directory(config['Contract']['DataDirectory']) # GO! LocalMain(config)
def Main(commands): # parse out the configuration file first conffiles = ['pcontract.toml'] confpaths = [".", "./etc", ContractEtc] parser = argparse.ArgumentParser() parser.add_argument('--config', help='configuration file', nargs='+') parser.add_argument('--config-dir', help='configuration file', nargs='+') parser.add_argument('--identity', help='Identity to use for the process', required=True, type=str) parser.add_argument( '--logfile', help='Name of the log file, __screen__ for standard output', type=str) parser.add_argument('--loglevel', help='Logging level', type=str) parser.add_argument('--ledger', help='URL for the Sawtooth ledger', type=str) parser.add_argument('--contract', help='Name of the contract', required=True, type=str) parser.add_argument('--source', help='Gipsy Scheme source for the contract', required=True, type=str) parser.add_argument('--save-file', help='Name of the file where contract data is stored', type=str) parser.add_argument('--key-dir', help='Directories to search for key files', nargs='+') parser.add_argument('--data-dir', help='Path for storing generated files', type=str) parser.add_argument('--source-dir', help='Directories to search for contract source', nargs='+', type=str) parser.add_argument('--eservice-url', help='List of enclave service URLs to use', nargs='+') parser.add_argument('--pservice-url', help='List of provisioning service URLs to use', nargs='+') options = parser.parse_args() # first process the options necessary to load the default configuration if options.config: conffiles = options.config if options.config_dir: confpaths = options.config_dir global config_map config_map['identity'] = options.identity config_map['contract'] = options.contract if options.data_dir: config_map['data'] = options.data_dir try: config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e: logger.error(str(e)) sys.exit(-1) # set up the logging configuration if config.get('Logging') is None: config['Logging'] = {'LogFile': '__screen__', 'LogLevel': 'INFO'} if options.logfile: config['Logging']['LogFile'] = options.logfile if options.loglevel: config['Logging']['LogLevel'] = options.loglevel.upper() plogger.setup_loggers(config.get('Logging', {})) # process the reset of the command parameters # set up the ledger configuration if config.get('Sawtooth') is None: config['Sawtooth'] = { 'LedgerURL': 'http://localhost:8008', } if options.ledger: config['Sawtooth']['LedgerURL'] = options.ledger # set up the service configuration if config.get('Service') is None: config['Service'] = { 'EnclaveServiceURLs': [], 'ProvisioningServiceURLs': [] } if options.eservice_url: config['Service']['EnclaveServiceURLs'] = options.eservice_url if options.pservice_url: config['Service']['ProvisioningServiceURLs'] = options.pservice_url # set up the key search paths if config.get('Key') is None: config['Key'] = { 'SearchPath': ['.', './keys', ContractKeys], 'FileName': options.identity + ".pem" } if options.key_dir: config['Key']['SearchPath'] = options.key_dir # set up the data paths if config.get('Contract') is None: config['Contract'] = { 'Name': options.contract, 'DataDirectory': ContractData, 'SaveFile': options.contract + '.pdo', 'SourceName': options.contract, 'SourceSearchPath': [".", "./contract", os.path.join(ContractHome, 'contracts')] } config['Contract']['SourceName'] = options.source if options.save_file: config['Contract']['SaveFile'] = options.save_file if options.data_dir: config['Contract']['DataDirectory'] = options.data_dir if options.source_dir: config['Contract']['SourceSearchPath'] = options.source_dir putils.set_default_data_directory(config['Contract']['DataDirectory']) # GO!!! LocalMain(commands, config)
def Main(): import pdo.common.config as pconfig import pdo.common.logger as plogger # parse out the configuration file first conffiles = ['pcontract.toml'] confpaths = [".", "./etc", ContractEtc] parser = argparse.ArgumentParser() parser.add_argument('--config', help='configuration file', nargs='+') parser.add_argument( '--config-dir', help='directories to search for the configuration file', nargs='+') parser.add_argument('-i', '--identity', help='Identity to use for the process', type=str) parser.add_argument('-c', '--contract', help='Name of the contract', type=str) parser.add_argument( '--logfile', help='Name of the log file, __screen__ for standard output', type=str) parser.add_argument('--loglevel', help='Logging level', type=str) parser.add_argument('--ledger', help='URL for the Sawtooth ledger', type=str) parser.add_argument('--data-dir', help='Directory for storing generated files', type=str) parser.add_argument('--source-dir', help='Directories to search for contract source', nargs='+', type=str) parser.add_argument('--key-dir', help='Directories to search for key files', nargs='+') parser.add_argument('--eservice-url', help='List of enclave service URLs to use', nargs='+') parser.add_argument('--pservice-url', help='List of provisioning service URLs to use', nargs='+') parser.add_argument('-m', '--mapvar', help='Define variables for script use', nargs=2, action='append') parser.add_argument('-s', '--script', help='File from which to read script', type=str) options = parser.parse_args() # first process the options necessary to load the default configuration if options.config: conffiles = options.config if options.config_dir: confpaths = options.config_dir global config_map config_map['identity'] = '__unknown__' if options.identity: config_map['identity'] = options.identity config_map['contract'] = '__unknown__' if options.data_dir: config_map['data'] = options.data_dir try: config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e: logger.error(str(e)) sys.exit(-1) # set up the logging configuration if config.get('Logging') is None: config['Logging'] = {'LogFile': '__screen__', 'LogLevel': 'INFO'} if options.logfile: config['Logging']['LogFile'] = options.logfile if options.loglevel: config['Logging']['LogLevel'] = options.loglevel.upper() plogger.setup_loggers(config.get('Logging', {})) # set up the ledger configuration if config.get('Sawtooth') is None: config['Sawtooth'] = { 'LedgerURL': 'http://localhost:8008', } if options.ledger: config['Sawtooth']['LedgerURL'] = options.ledger # set up the key search paths if config.get('Key') is None: config['Key'] = { 'SearchPath': ['.', './keys', ContractKeys], 'FileName': options.identity + ".pem" } if options.key_dir: config['Key']['SearchPath'] = options.key_dir # set up the service configuration if config.get('Service') is None: config['Service'] = { 'EnclaveServiceURLs': [], 'ProvisioningServiceURLs': [] } if options.eservice_url: config['Service']['EnclaveServiceURLs'] = options.eservice_url if options.pservice_url: config['Service']['ProvisioningServiceURLs'] = options.pservice_url # set up the data paths if config.get('Contract') is None: config['Contract'] = { 'DataDirectory': ContractData, 'SourceSearchPath': [".", "./contract", os.path.join(ContractHome, 'contracts')] } if options.data_dir: config['Contract']['DataDirectory'] = options.data_dir if options.source_dir: config['Contract']['SourceSearchPath'] = options.source_dir putils.set_default_data_directory(config['Contract']['DataDirectory']) if options.script: config["ScriptFile"] = options.script if options.mapvar: varmap = config.get("VariableMap", {}) for (k, v) in options.mapvar: varmap[k] = v config["VariableMap"] = varmap # GO! LocalMain(config)
def Main(): import pdo.common.config as pconfig import pdo.common.logger as plogger # parse out the configuration file first conffiles = ['pcontract.toml'] confpaths = [".", "./etc", ContractEtc] parser = argparse.ArgumentParser() parser.add_argument('--config', help='configuration file', nargs='+') parser.add_argument('--config-dir', help='configuration file', nargs='+') parser.add_argument('--identity', help='Identity to use for the process', type=str, required=True) parser.add_argument( '--logfile', help='Name of the log file, __screen__ for standard output', type=str) parser.add_argument('--loglevel', help='Logging level', type=str) parser.add_argument('--ledger', help='URL for the Sawtooth ledger', type=str) parser.add_argument('--save-file', help='Name of the file where contract data is stored', type=str, required=True) parser.add_argument('--key-dir', help='Directories to search for key files', nargs='+') parser.add_argument('--data-dir', help='Path for storing generated files', type=str) parser.add_argument('--source-dir', help='Directories to search for contract source', nargs='+', type=str) parser.add_argument( '--enclave', help= 'URL of the enclave service to use, or random to pick one randomly', type=str) parser.add_argument('message', help="Message to evaluate", type=str) options = parser.parse_args() # first process the options necessary to load the default configuration if options.config: conffiles = options.config if options.config_dir: confpaths = options.config_dir global config_map config_map['identity'] = options.identity config_map['contract'] = '__unknown__' if options.data_dir: config_map['data'] = options.data_dir try: config = pconfig.parse_configuration_files(conffiles, confpaths, config_map) except pconfig.ConfigurationException as e: logger.error(str(e)) sys.exit(-1) # set up the logging configuration if config.get('Logging') is None: config['Logging'] = {'LogFile': '__screen__', 'LogLevel': 'INFO'} if options.logfile: config['Logging']['LogFile'] = options.logfile if options.loglevel: config['Logging']['LogLevel'] = options.loglevel.upper() plogger.setup_loggers(config.get('Logging', {})) # set up the ledger configuration if config.get('Sawtooth') is None: config['Sawtooth'] = { 'LedgerURL': 'http://localhost:8008', } if options.ledger: config['Sawtooth']['LedgerURL'] = options.ledger # make sure we have an enclave if config.get('Service') is None: config['Service'] = {'PreferredEnclaveService': 'http://locahost:7001'} if options.enclave: if options.enclave == 'random': options.enclave = random.choice(config['Service'].get( 'EnclaveServiceURLs', ['http://localhost:7001'])) config['Service']['PreferredEnclaveService'] = options.enclave # set up the key search paths if config.get('Key') is None: config['Key'] = { 'SearchPath': ['.', './keys', ContractKeys], 'FileName': options.identity + ".pem" } if options.key_dir: config['Key']['SearchPath'] = options.key_dir # set up the data paths if config.get('Contract') is None: config['Contract'] = { 'DataDirectory': ContractData, 'SaveFile': options.save_file } config['Contract']['SaveFile'] = options.save_file if options.data_dir: config['Contract']['DataDirectory'] = options.data_dir if options.source_dir: config['Contract']['SourceSearchPath'] = options.source_dir putils.set_default_data_directory(config['Contract']['DataDirectory']) # GO! LocalMain(config, options.message)