diff --git a/.env.production.example b/.env.production.example index 686f178..440bc70 100644 --- a/.env.production.example +++ b/.env.production.example @@ -6,6 +6,9 @@ POSTGRES_DB=delivery_tracker # JWT JWT_SECRET=your_random_jwt_secret_min_32_chars +# Seed admin password +SEED_ADMIN_PASSWORD=your_secure_password_here + # Gitea Registry credentials for Watchtower GITEA_REGISTRY=gitea.your-domain.com/yourusername GITEA_USER=your_gitea_username diff --git a/backend/cmd/seed.go/main.go b/backend/cmd/seed/main.go similarity index 81% rename from backend/cmd/seed.go/main.go rename to backend/cmd/seed/main.go index f374311..cb57c5a 100644 --- a/backend/cmd/seed.go/main.go +++ b/backend/cmd/seed/main.go @@ -24,21 +24,18 @@ func main() { queries := db.New(pool) - // Проверяем, есть ли уже пользователи _, err = queries.GetUserByUsername(ctx, "admin") if err == nil { log.Println("admin user already exists, skipping seed") return } - // Создаём через auth service (правильное хеширование) secret := []byte(os.Getenv("JWT_SECRET")) if len(secret) == 0 { log.Fatalf("JWT_SECRET not set") } authService := auth.New(queries, secret, 0) - // Пароль из env или дефолтный (только для разработки!) password := os.Getenv("SEED_ADMIN_PASSWORD") if password == "" { password = "admin123" // ⚠️ только для dev! diff --git a/frontend/.env.example b/frontend/.env.example index 4ba1803..ce37a68 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -1,4 +1,4 @@ # API Configuration # Leave empty to use proxy (recommended for local dev and production) # Or set full URL like http://localhost:8081 for direct API access -VITE_API_URL= +VITE_API_URL=http://localhost:8080 diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 3ddb5b8..a205fe8 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -29,7 +29,7 @@ export default defineConfig({ allowedHosts: ['delivery.loca.lt', '.loca.lt'], proxy: { '/api': { - target: 'http://localhost:8081', + target: 'http://localhost:8080', changeOrigin: true, }, },