fix: remove passlib import from migration 0001, embed static hash
All checks were successful
Build containers when image tags change / build-if-image-changed (frontend, shorefront-frontend, shorefront frontend, frontend/Dockerfile, git.baumann.gr/adebaumann/shorefront-frontend, .frontend.image) (push) Successful in 30s
Build containers when image tags change / build-if-image-changed (backend, shorefront-backend, shorefront backend, backend/Dockerfile, git.baumann.gr/adebaumann/shorefront-backend, .backend.image) (push) Successful in 1m29s
All checks were successful
Build containers when image tags change / build-if-image-changed (frontend, shorefront-frontend, shorefront frontend, frontend/Dockerfile, git.baumann.gr/adebaumann/shorefront-frontend, .frontend.image) (push) Successful in 30s
Build containers when image tags change / build-if-image-changed (backend, shorefront-backend, shorefront backend, backend/Dockerfile, git.baumann.gr/adebaumann/shorefront-backend, .backend.image) (push) Successful in 1m29s
This commit is contained in:
@@ -6,14 +6,16 @@ Create Date: 2026-02-28
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from passlib.context import CryptContext
|
||||
|
||||
revision = "0001"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
|
||||
# Pre-computed bcrypt hash of "admin". Used only for seeding the initial admin
|
||||
# row; hashed_password becomes nullable in migration 0002 (SSO transition) and
|
||||
# is never validated at login.
|
||||
_ADMIN_HASH = "$2b$12$E8Td3Igd66V.udnDuflWFOhhhZDYFRHwLpgIsw.cRQtMf4h102sj."
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
@@ -98,7 +100,7 @@ def upgrade() -> None:
|
||||
"INSERT INTO users (username, email, hashed_password, is_active) "
|
||||
"VALUES (:u, :e, :p, true)"
|
||||
),
|
||||
{"u": "admin", "e": "admin@localhost", "p": pwd_context.hash("admin")},
|
||||
{"u": "admin", "e": "admin@localhost", "p": _ADMIN_HASH},
|
||||
)
|
||||
user_id = conn.execute(sa.text("SELECT id FROM users WHERE username='admin'")).scalar()
|
||||
|
||||
|
||||
@@ -42,4 +42,4 @@ keycloak:
|
||||
redirectUri: https://shorefront.baumann.gr/api/auth/oidc/callback
|
||||
|
||||
containers:
|
||||
version: "0.004"
|
||||
version: "0.005"
|
||||
|
||||
Reference in New Issue
Block a user