certimine/config/config.example.php
remaster ff0fd6a89d API Peñasquito: ticket persistente, company y mejor flujo de búsqueda
- Renombrado «DC3» a «API Peñasquito» (URL base del documento) en UI/docs;
  rutas y claves de config conservadas por compatibilidad.
- Persistencia de ticket_id en nueva tabla `penasquito_tickets`:
  POST /search/ guarda el ticket y los siguientes requests retoman
  GET /result/<ticket_id>/ sin reencolar.
- Polling acotado por request HTTP (~6 s) con `PenasquitoPendingException`
  y caja «reintentar» en lookup; ticket queda válido 1 h.
- `users_cache.company` nuevo (con migración idempotente); persistResult
  guarda empresa + competencias en transacción y aplica source distinto.
- Mensajes HTTP específicos (400/401/403/404/408/429/5xx) y `/` final
  forzado en rutas (DRF), FOLLOWLOCATION habilitado.
- Vista de perfil muestra «Empresa» y aviso cuando no hay competencias.
- Auth::login evita doble fetch cuando ya tenemos el `result` del API.
- i18n ES/EN actualizados; lookup_pending_*; limpieza de archivos lang.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 19:43:37 -06:00

78 lines
3.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Plantilla: copiar a **config.php** (config.php está en .gitignore).
*
* Token del API en la **URL base del documento** (p. ej. penasquito.wotbi.com). La clave de array
* `penasquito_dc3` es histórica: las rutas remotas llevan `/api/v1/dc3/...` según ese documento.
*
* Orden del token: CERTIMINE_PENASQUITO_TOKEN → CERTIMINE_DC3_TOKEN (alias) → static_token en config.php → config/token.php.
*/
return [
'app' => [
'name' => 'CertiMine',
'base_path' => dirname(__DIR__),
'public_url' => 'http://127.0.0.1:8080',
'timezone' => 'America/Mexico_City',
'qr_secret' => 'change-me-qr-hmac',
'qr_enforce' => false,
'debug' => false,
],
'db' => [
'host' => '127.0.0.1',
'port' => 3306,
'name' => 'certimine',
'user' => 'root',
'pass' => 'R3m4st3r',
'charset' => 'utf8mb4',
],
'session' => [
'name' => 'CERTIMINESESSID',
'cookie_lifetime' => 0,
'cookie_secure' => false,
'cookie_httponly' => true,
'cookie_samesite' => 'Lax',
],
/**
* API REST en la URL base del PDF (Wotbi): búsqueda por passport. Rutas = las del documento.
*/
'penasquito_dc3' => [
'base_url' => 'https://penasquito.wotbi.com',
'static_token' => '',
'search_path' => '/api/v1/dc3/competencies/passports/search/',
'result_path_template' => '/api/v1/dc3/competencies/passports/result/{ticket_id}/',
'status_path' => '/api/v1/dc3/competencies/passports/status/',
'authorization_header' => 'Authorization',
'authorization_scheme' => 'Token ',
/**
* Doc §1.6: polling al GET /result/ cada ~2 s (típico 5–15 s sin caché).
* Aquí se hace polling acotado por request HTTP (≈6 s) para no agotar el max_execution_time
* del web; el ticket_id se persiste en penasquito_tickets y el siguiente request retoma
* el GET /result/<ticket_id>/ sin volver a encolar. Para tareas CLI/cron sube max_attempts.
*/
'poll_interval_seconds' => 2,
'poll_max_attempts' => 3,
'timeout_seconds' => 30,
],
/**
* Modo legacy (JSON login + JWT) si no usa token del API Peñasquito (documento).
*/
'mobiliseme' => [
'base_url' => 'https://api.mobiliseme.example',
'timeout_seconds' => 20,
'mock' => true,
'login_path' => '/auth/login',
'login_username_field' => 'username',
'login_password_field' => 'password',
'token_json_path' => 'access_token',
'authorization_header' => 'Authorization',
'authorization_scheme' => 'Bearer ',
'profile_path' => '/me',
'profile_external_id_path' => 'id',
'profile_name_path' => 'full_name',
'profile_type_path' => 'type',
'profile_employee_number_path' => 'employee_number',
'person_certificates_path' => '/persons/{id}/certificates',
'certificate_list_path' => 'items',
'webhook_secret' => '',
],
];