コード例 #1
0
def patch_nodes_p2p_config(testnet_config: TestnetConfiguration,
                           nodes_config_folders, port_first):
    for index, config_folder in enumerate(nodes_config_folders):
        config = config_folder / 'p2p.toml'
        data = utils.read_toml_file(config)
        p2p_toml.patch(data, testnet_config, index, port_first)
        utils.write_toml_file(config, data)
コード例 #2
0
def patch_proxy_config(testnet_config: TestnetConfiguration):
    proxy_config_file = testnet_config.proxy_config_folder() / 'config.toml'
    nodes = testnet_config.api_addresses_sharded_for_proxy_config()
    data = utils.read_toml_file(proxy_config_file)
    data['Observers'] = nodes
    data['FullHistoryNodes'] = nodes
    data['GeneralSettings']['ServerPort'] = testnet_config.proxy_port()
    utils.write_toml_file(proxy_config_file, data)

    api_config_file = path.join(testnet_config.proxy_config_folder(),
                                'apiConfig', 'v1_0.toml')
    data = utils.read_toml_file(api_config_file)
    routes = data['APIPackages']['transaction']['Routes']
    for route in routes:
        route["Open"] = True
    utils.write_toml_file(api_config_file, data)
コード例 #3
0
def patch_node_config(testnet_config: TestnetConfiguration):
    for node_config in testnet_config.all_nodes_config_folders():
        config_file = node_config / 'config.toml'
        data = utils.read_toml_file(config_file)
        node_config_toml.patch(data, testnet_config)
        utils.write_toml_file(config_file, data)

        config_file = node_config / 'api.toml'
        data = utils.read_toml_file(config_file)
        node_config_toml.patch_api(data, testnet_config)
        utils.write_toml_file(config_file, data)

        genesis_smart_contracts_file = node_config / 'genesisSmartContracts.json'
        data = utils.read_json_file(genesis_smart_contracts_file)
        genesis_smart_contracts_json.patch(data, testnet_config)
        utils.write_json_file(genesis_smart_contracts_file, data)
コード例 #4
0
def patch_seednode_p2p_config(testnet_config: TestnetConfiguration):
    seednode_config = testnet_config.seednode_config_folder()
    seednode_config_file = seednode_config / 'p2p.toml'

    data = utils.read_toml_file(seednode_config_file)
    p2p_toml.patch_for_seednode(data, testnet_config)
    utils.write_toml_file(seednode_config_file, data)
コード例 #5
0
    def get_local_config(cls, filename):
        if filename is None or filename == '':
            filename = Path() / "testnet.toml"
            if not filename.exists():
                return dict()

        return utils.read_toml_file(filename)
コード例 #6
0
    def get_local_config(cls, filename):
        if filename is None or filename == '':
            filename = Path() / "testnet.toml"
            if not filename.exists():
                return dict()

        logger.info('using local testnet config from %s', filename)
        return utils.read_toml_file(filename)
コード例 #7
0
def patch_proxy_config(testnet_config: TestnetConfiguration):
    proxy_config_file = testnet_config.proxy_config_folder() / 'config.toml'
    observers = testnet_config.observer_addresses_sharded_for_proxy_config()
    data = utils.read_toml_file(proxy_config_file)
    data['Observers'] = observers
    data['FullHistoryNodes'] = observers
    data['GeneralSettings']['ServerPort'] = testnet_config.proxy_port()
    utils.write_toml_file(proxy_config_file, data)
コード例 #8
0
 def get_sdk_testnet_config(cls):
     default = cls.default()
     filename = workstation.get_tools_folder() / "testnet.toml"
     logger.info('sdk_testnet_config filename %s', filename)
     if not filename.exists():
         logger.info('writing sdk_testnet_config from defaults')
         utils.write_toml_file(str(filename), default)
         return default
     sdk_testnet_config = utils.read_toml_file(filename)
     return merge_configs(default, sdk_testnet_config)
コード例 #9
0
ファイル: project_rust.py プロジェクト: stjordanis/elrond-sdk
 def _parse_file(self):
     self.data = utils.read_toml_file(self.path)