alternative pk load
This commit is contained in:
parent
d5812fed03
commit
29fb14b8e6
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,3 +19,4 @@ agent-mAId/output.wav
|
|||||||
.node-persist/storage/*
|
.node-persist/storage/*
|
||||||
logs/*
|
logs/*
|
||||||
crypto/sol/.env.secret
|
crypto/sol/.env.secret
|
||||||
|
crypto/sol/secret.pk
|
||||||
|
@ -41,6 +41,18 @@ load_dotenv()
|
|||||||
# Load secret environment variables
|
# Load secret environment variables
|
||||||
load_dotenv('.env.secret')
|
load_dotenv('.env.secret')
|
||||||
pk = os.getenv("PK")
|
pk = os.getenv("PK")
|
||||||
|
if not pk:
|
||||||
|
try:
|
||||||
|
with open('./secret.pk', 'r') as f:
|
||||||
|
pk = f.read().strip()
|
||||||
|
if pk:
|
||||||
|
logging.info("Private key loaded successfully from file.")
|
||||||
|
else:
|
||||||
|
logging.warning("Private key file is empty.")
|
||||||
|
except FileNotFoundError:
|
||||||
|
logging.warning("Private key file not found.")
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"Error reading private key file: {str(e)}")
|
||||||
if not pk
|
if not pk
|
||||||
logging.error("Private key not found in environment variables. Will not be able to sign transactions.")
|
logging.error("Private key not found in environment variables. Will not be able to sign transactions.")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user