node-facts: verbatim operator-verified files (fixture env without dotfile)
This commit is contained in:
+3
-2
@@ -11,6 +11,7 @@ Exit 0 always once .env is readable; exit 2 if .env/COMPOSE_FILE is missing (one
|
||||
import concurrent.futures as cf, datetime, json, os, re, socket, subprocess, sys, time, urllib.request, ssl
|
||||
|
||||
BASE = os.path.dirname(os.path.abspath(__file__))
|
||||
FIXTURES = os.environ.get("NODE_FACTS_FIXTURES") # test mode: answer HTTP from <dir>/<method-or-path>.json, env from <dir>/env, no network
|
||||
INFRA = {"base", "rpc", "monitoring", "backup-http", "drpc", "drpc-free", "squidfura", "squidfura-backend", "oracle", "extra"}
|
||||
NOW = lambda: datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
SEMVER = re.compile(r"(\d+)\.(\d+)\.(\d+)")
|
||||
@@ -20,7 +21,8 @@ CTX = ssl.create_default_context()
|
||||
def env():
|
||||
e = {}
|
||||
try:
|
||||
for line in open(os.path.join(BASE, ".env")):
|
||||
envfile = os.path.join(FIXTURES, "env") if FIXTURES else os.path.join(BASE, ".env") # fixture mode: no dotfile needed
|
||||
for line in open(envfile):
|
||||
line = line.strip()
|
||||
if line and not line.startswith("#") and "=" in line:
|
||||
k, v = line.split("=", 1); e[k] = v.strip().strip('"').strip("'")
|
||||
@@ -29,7 +31,6 @@ def env():
|
||||
return e
|
||||
|
||||
|
||||
FIXTURES = os.environ.get("NODE_FACTS_FIXTURES") # test mode: answer HTTP from <dir>/<method-or-path>.json, no network
|
||||
|
||||
|
||||
def _fixture(url, body):
|
||||
|
||||
Reference in New Issue
Block a user