Skip to content

Commit

Permalink
Merge pull request #4 from NillionNetwork/bug/bootnodes-hardcoded
Browse files Browse the repository at this point in the history
add optional bootnodes parameter, default to .env
  • Loading branch information
oceans404 authored Aug 19, 2024
2 parents d8b97a9 + 1b33a37 commit 03188ec
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions nillion_python_helpers/client.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import os

import py_nillion_client as nillion


def create_nillion_client(userkey, nodekey):
def create_nillion_client(userkey, nodekey, bootnodes=None):
"""
Creates and initializes a Nillion client.
Args:
userkey: The user key for the Nillion client.
nodekey: The node key for the Nillion client.
bootnodes: Optional; a list of bootnode addresses. Defaults to the value of
the "NILLION_BOOTNODE_MULTIADDRESS" environment variable.
Returns:
nillion.NillionClient: The initialized Nillion client instance.
"""
bootnodes = [os.getenv("NILLION_BOOTNODE_MULTIADDRESS")]
if bootnodes is None:
bootnodes = [os.getenv("NILLION_BOOTNODE_MULTIADDRESS")]

return nillion.NillionClient(
nodekey, bootnodes, nillion.ConnectionMode.relay(), userkey
nodekey,
bootnodes,
nillion.ConnectionMode.relay(),
userkey,
)

0 comments on commit 03188ec

Please sign in to comment.