config: load public cc-ci runtime environment
This commit is contained in:
@@ -46,6 +46,7 @@ from datetime import datetime, timezone
|
||||
|
||||
LOGDIR = "/srv/cc-ci/.cc-ci-logs"
|
||||
TESTENV = "/srv/cc-ci/.testenv"
|
||||
PUBLIC_ENV = "/srv/cc-ci/cc-ci/.env.public"
|
||||
INFRA = {"cc-ci", "cc-ci-orchestrator", "cc-ci-secrets"}
|
||||
HOST_REPORTS = "/var/lib/cc-ci-reports"
|
||||
# Both kinds live in ONE archive, distinguished by a suffix on a common title.
|
||||
@@ -56,14 +57,16 @@ KINDS = {"week": ("The Recipe Report", "Week of {d} — full"),
|
||||
|
||||
def _env():
|
||||
e = {}
|
||||
try:
|
||||
for ln in open(TESTENV):
|
||||
for path in (PUBLIC_ENV, TESTENV):
|
||||
try:
|
||||
lines = open(path)
|
||||
except FileNotFoundError:
|
||||
continue
|
||||
for ln in lines:
|
||||
ln = ln.strip()
|
||||
if "=" in ln and not ln.startswith("#"):
|
||||
k, v = ln.split("=", 1)
|
||||
e[k] = v.strip().strip('"').strip("'")
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
return e
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user