alternative pk load
This commit is contained in:
@ -41,6 +41,18 @@ load_dotenv()
|
||||
# Load secret environment variables
|
||||
load_dotenv('.env.secret')
|
||||
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
|
||||
logging.error("Private key not found in environment variables. Will not be able to sign transactions.")
|
||||
|
||||
|
Reference in New Issue
Block a user