fix(auth): respect SEED_DEMO_USERS=false to prevent re-seeding demo users

This commit is contained in:
weichen
2026-09-16 03:12:31 +00:00
parent fbda195b7f
commit 53bb71adae
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -87,6 +87,7 @@ services:
condition: service_healthy
environment:
ENV: test
SEED_DEMO_USERS: "false"
HTTP_ADDR: ":${HTTP_PORT:-8081}"
HTTP_PORT: "${HTTP_PORT:-8081}"
HTTP_HOST: "0.0.0.0"
+7
View File
@@ -3,6 +3,7 @@ package auth
import (
"context"
"fmt"
"os"
"chat-agent-system/internal/config"
"github.com/jackc/pgx/v5/pgxpool"
@@ -63,6 +64,9 @@ func BootstrapDevSeedUsers(ctx context.Context, store AuthStore, cfg *config.Con
if store == nil || cfg == nil {
return nil
}
if os.Getenv("SEED_DEMO_USERS") == "false" || os.Getenv("DISABLE_DEV_SEED_USERS") == "true" {
return nil
}
if cfg.Env != "dev" && cfg.Env != "test" && cfg.Env != "" {
return nil
}
@@ -109,6 +113,9 @@ func ReactivateDevSeedUsers(ctx context.Context, store AuthStore, cfg *config.Co
if store == nil || cfg == nil {
return nil
}
if os.Getenv("SEED_DEMO_USERS") == "false" || os.Getenv("DISABLE_DEV_SEED_USERS") == "true" {
return nil
}
if cfg.Env != "dev" && cfg.Env != "test" && cfg.Env != "" {
return nil
}