def get_config():
configure_logger()
p = configargparse.getArgumentParser(default_config_files=[os.path.join(PATH, 'conf.ini'),
'/etc/cert-issuer/conf.ini'])
add_arguments(p)
parsed_config, _ = p.parse_known_args()
if not parsed_config.safe_mode:
logging.warning('Your app is configured to skip the wifi check when the USB is plugged in. Read the '
'documentation to ensure this is what you want, since this is less secure')
# overwrite with enum
parsed_config.chain = Chain.parse_from_chain(parsed_config.chain)
# ensure it's a supported chain
if parsed_config.chain.blockchain_type != BlockchainType.bitcoin and \
parsed_config.chain.blockchain_type != BlockchainType.ethereum and \
parsed_config.chain.blockchain_type != BlockchainType.mock:
raise UnknownChainError(parsed_config.chain.name)
logging.info('This run will try to issue on the %s chain', parsed_config.chain.name)
if parsed_config.chain.blockchain_type == BlockchainType.bitcoin:
bitcoin_chain_for_python_bitcoinlib = parsed_config.chain
if parsed_config.chain == Chain.bitcoin_regtest:
bitcoin_chain_for_python_bitcoinlib = Chain.bitcoin_regtest
bitcoin.SelectParams(chain_to_bitcoin_network(bitcoin_chain_for_python_bitcoinlib))
configure_logger()
return parsed_config
评论列表
文章目录