-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make .env file optional on regtest (#657)
- Loading branch information
1 parent
5369ed8
commit 9f5122a
Showing
1 changed file
with
25 additions
and
10 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,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) |