Skip to content

Commit

Permalink
fix: make .env file optional on regtest (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 authored Aug 15, 2024
1 parent 5369ed8 commit 9f5122a
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
#! /bin/python3

import sys
import json

def handle_coop_disabled():
print("Cooperative signatures are disabled in config")
sys.exit(1)

with open("./src/config.ts", "r") as f:
for line in f:
if "cooperativeDisabled" not in line:
continue

if "true" in line:
print("Cooperative signatures are disabled in config")
sys.exit(1)
if "false" not in line:
handle_coop_disabled()

network: str | None = None

with open("./public/config.json") as f:
data = json.load(f)

network = data["network"]

if data.get("cooperativeDisabled", False):
handle_coop_disabled()

break

with open(".env", "r") as f:
data = f.read()
# .env file is not required on regtest
if network != "regtest":
with open(".env", "r") as f:
data = f.read()

for var in ["VITE_RSK_LOG_SCAN_ENDPOINT"]:
if var not in data:
print(f"{var} not in .env file")
sys.exit(1)
for var in ["VITE_RSK_LOG_SCAN_ENDPOINT"]:
if var not in data:
print(f"{var} not in .env file")
sys.exit(1)

0 comments on commit 9f5122a

Please sign in to comment.