-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from NillionNetwork/bug/bootnodes-hardcoded
add optional bootnodes parameter, default to .env
- Loading branch information
Showing
1 changed file
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |