gate2: fix prestart.sh — inline password for ALTER ROLE (prepared statements dont work with ALTER ROLE)
This commit is contained in:
+3
-1
@@ -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}')
|
||||||
|
|||||||
Reference in New Issue
Block a user