gate2: fix prestart.sh — inline password for ALTER ROLE (prepared statements dont work with ALTER ROLE)

This commit is contained in:
Agent Zero
2026-07-31 21:42:55 +02:00
parent 9124b17a8e
commit 2a7412e49f
+3 -1
View File
@@ -55,7 +55,9 @@ async def set_passwords():
async with engine.begin() as conn: async with engine.begin() as conn:
for role in roles: for role in roles:
try: try:
await conn.execute(text(f'ALTER ROLE {role} WITH LOGIN PASSWORD :pwd'), {'pwd': pwd}) # ALTER ROLE doesn't support prepared statement parameters
# so we inline the password (extracted from DB URL, safe)
await conn.execute(text(f"ALTER ROLE {role} WITH LOGIN PASSWORD '{pwd}'"))
print(f'[prestart] Password set for {role}') print(f'[prestart] Password set for {role}')
except Exception as e: except Exception as e:
print(f'[prestart] WARNING: Could not set password for {role}: {e}') print(f'[prestart] WARNING: Could not set password for {role}: {e}')