8cadacb553
gates / gates (push) Successful in 26s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
29 lines
1.9 KiB
Python
29 lines
1.9 KiB
Python
# Decision 47 part A: each app's OWN sign-up switch, read from SIGNUP_CLOSED / SIGNUP_OPEN (default: open, so an
|
|
# installed app is unchanged by the catalog). argv: repo [--closed-default] (the spike's lock-from-install variant).
|
|
import os, re, sys
|
|
R = sys.argv[1]; closed = "--closed-default" in sys.argv
|
|
NATIVE = { # app: (compose service, native env, which variable, value meaning CLOSED)
|
|
"adventurelog": ("adventurelog", "DISABLE_REGISTRATION", "SIGNUP_CLOSED"),
|
|
"calcom": ("calcom", "NEXT_PUBLIC_DISABLE_SIGNUP", "SIGNUP_CLOSED"),
|
|
"gitea": ("gitea", "GITEA__service__DISABLE_REGISTRATION", "SIGNUP_CLOSED"),
|
|
"gramps-web": ("gramps-web", "GRAMPSWEB_REGISTRATION_DISABLED", "SIGNUP_CLOSED"),
|
|
"homebox": ("homebox", "HBOX_OPTIONS_ALLOW_REGISTRATION", "SIGNUP_OPEN"),
|
|
"papra": ("papra", "AUTH_IS_REGISTRATION_ENABLED", "SIGNUP_OPEN"),
|
|
"sparkyfitness": ("sparkyfitness-server", "SPARKY_FITNESS_DISABLE_SIGNUP", "SIGNUP_CLOSED"),
|
|
"termix": ("termix", "ALLOW_REGISTRATION", "SIGNUP_OPEN"),
|
|
"vikunja": ("vikunja", "VIKUNJA_SERVICE_ENABLEREGISTRATION", "SIGNUP_OPEN"),
|
|
}
|
|
only = [a for a in sys.argv[2:] if not a.startswith("--")] or list(NATIVE)
|
|
for app in only:
|
|
svc, env, var = NATIVE[app]
|
|
p = os.path.join(R, "templates", app, "docker-compose.yml")
|
|
s = open(p).read()
|
|
s = re.sub(r"\n\s+- " + re.escape(env) + r"=[^\n]*", "", s) # an existing fixed value (sparkyfitness) goes
|
|
default = ("true" if var == "SIGNUP_CLOSED" else "false") if closed else ("false" if var == "SIGNUP_CLOSED" else "true")
|
|
line = f" # decision 47: the app's own sign-up switch — open until the box closes it after the first admin (after_setup)\n - {env}=${{{var}:-{default}}}\n"
|
|
m = re.search(r"\n " + re.escape(svc) + r":\n(?: [^\n]*\n|\n)*? environment:\n", s)
|
|
assert m, (app, svc)
|
|
s = s[:m.end()] + line + s[m.end():]
|
|
open(p, "w").write(s)
|
|
print("native switch wired:", only, "closed-default" if closed else "open-default")
|