fix(gtea): derive STACK_NAME from domain (dots→underscores) in UPGRADE_SECRET_PREP
abra does NOT write STACK_NAME to the app's .env file — it derives it at runtime by replacing dots with underscores (e.g. gite-e1cb78.ci.commoninternet.net → gite-e1cb78_ci_commoninternet_net). Build #691 failed with 'STACK_NAME not found' because the env file read was looking for a key that doesn't exist. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@ -71,18 +71,9 @@ def UPGRADE_SECRET_PREP(ctx):
|
|||||||
import base64
|
import base64
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
env_path = _os.path.expanduser(f"~/.abra/servers/default/{ctx.domain}.env")
|
# abra derives STACK_NAME from the domain by replacing dots with underscores
|
||||||
stack_name = None
|
# (e.g. gite-e1cb78.ci.commoninternet.net → gite-e1cb78_ci_commoninternet_net).
|
||||||
try:
|
stack_name = ctx.domain.replace(".", "_")
|
||||||
with open(env_path) as fh:
|
|
||||||
for line in fh:
|
|
||||||
if line.startswith("STACK_NAME="):
|
|
||||||
stack_name = line.split("=", 1)[1].strip().strip('"').strip("'")
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
if not stack_name:
|
|
||||||
raise RuntimeError(f"UPGRADE_SECRET_PREP: STACK_NAME not found in {env_path}")
|
|
||||||
|
|
||||||
docker_secret = f"{stack_name}_lfs_jwt_secret_v1"
|
docker_secret = f"{stack_name}_lfs_jwt_secret_v1"
|
||||||
value = base64.urlsafe_b64encode(_os.urandom(32)).rstrip(b"=").decode()
|
value = base64.urlsafe_b64encode(_os.urandom(32)).rstrip(b"=").decode()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user