fix(auth): respect SEED_DEMO_USERS=false to prevent re-seeding demo users
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user