66 lines
3.5 KiB
Markdown
66 lines
3.5 KiB
Markdown
### Objet
|
||
Matrice des variables d’environnement pour `lecoffre-front`, `lecoffre-back-mini` et orchestrations `lecoffre_node`, avec cohérence Nginx/basePath.
|
||
|
||
### Variables côté Front (Next.js)
|
||
- **Exposition**: `NEXT_PUBLIC_*` via `next.config.js` (env/publicRuntimeConfig/serverRuntimeConfig)
|
||
- **Consommation**: `src/front/Config/VariablesFront.ts` et services API
|
||
|
||
- NEXT_PUBLIC_BACK_API_PROTOCOL: protocole back (ex: `http`)
|
||
- NEXT_PUBLIC_BACK_API_HOST: hôte back (ex: `127.0.0.1` ou `dev4.4nkweb.com`)
|
||
- NEXT_PUBLIC_BACK_API_PORT: port back (ex: `8080`)
|
||
- NEXT_PUBLIC_BACK_API_ROOT_URL: préfixe API (ex: `/api`)
|
||
- NEXT_PUBLIC_BACK_API_VERSION: version API (ex: `/v1`)
|
||
- NEXT_PUBLIC_FRONT_APP_HOST: URL publique du front (utilisée pour ID.not redirect)
|
||
- NEXT_PUBLIC_FRONT_APP_PORT: port front si nécessaire
|
||
- NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT: endpoint authorize (ex: `/user/auth`)
|
||
- NEXT_PUBLIC_IDNOT_CLIENT_ID: client_id ID.not
|
||
- NEXT_PUBLIC_IDNOT_BASE_URL: base URL ID.not
|
||
- NEXT_PUBLIC_IDNOT_REDIRECT_URI: redirect URI explicite; fallback vers `${FRONT_APP_HOST}/authorized-client`
|
||
- NEXT_PUBLIC_DOCAPOSTE_API_URL: base API Docaposte
|
||
- NEXT_PUBLIC_HOTJAR_SITE_ID / NEXT_PUBLIC_HOTJAR_VERSION: télémétrie
|
||
- NEXT_PUBLIC_4NK_URL / NEXT_PUBLIC_4NK_IFRAME_URL: intégrations 4NK
|
||
- NEXT_PUBLIC_API_URL: éventuellement raccourci général d’API
|
||
- NEXT_PUBLIC_DEFAULT_VALIDATOR_ID / NEXT_PUBLIC_DEFAULT_STORAGE_URLS: valeurs par défaut SDK
|
||
|
||
### Variables côté Back (Express)
|
||
- PORT: port d’écoute (défaut 8080)
|
||
- DEFAULT_STORAGE: URL de stockage par défaut (défaut `https://dev3.4nkweb.com/storage`)
|
||
- APP_HOST: URL front (défaut `http://localhost:3000`) – utilisé aussi par `stripe`
|
||
- STRIPE_SECRET_KEY / STRIPE_WEBHOOK_SECRET
|
||
- IDNOT_CLIENT_ID / IDNOT_CLIENT_SECRET / IDNOT_REDIRECT_URI / IDNOT_TOKEN_URL
|
||
- IDNOT_API_KEY / IDNOT_API_BASE_URL / IDNOT_ANNUARY_BASE_URL
|
||
|
||
### Orchestration Docker / Nginx (lecoffre_node)
|
||
- Compose publie:
|
||
- `lecoffre-back`: `127.0.0.1:8080` (proxy Nginx `/api/` et `/back/`)
|
||
- `lecoffre-front`: `127.0.0.2:3004` (front Next.js)
|
||
- Services SDK: `sdk_relay` (8090), `sdk_signer` (3001), `sdk_storage` (8081), `blindbit` (8000)
|
||
- Nginx `dev4.4nkweb.com.conf`:
|
||
- `/api/` → `http://127.0.0.1:8080/api/`
|
||
- `/back/(.*)` → `http://127.0.0.1:8080/api/$1`
|
||
- `/` → `http://127.0.0.1:3003` (ihm_client)
|
||
- `/lecoffre` et `/lecoffre/` → `http://127.0.0.2:3004/lecoffre/`
|
||
- `/_next/` → `http://127.0.0.2:3004/_next/`
|
||
|
||
### Cohérence basePath Nginx/Next
|
||
- Next.js `basePath: '/lecoffre'` (voir `next.config.js`)
|
||
- Nginx proxy `/lecoffre` et `/_next/` vers le front sur 3004
|
||
- Impacts: routes, assets statiques, liens internes doivent inclure le `basePath`
|
||
|
||
### Qui consomme quoi
|
||
- Front:
|
||
- API back: `NEXT_PUBLIC_BACK_API_*` utilisés par `BaseApiService`, `Auth` (IdNot), Admin APIs (Subscriptions, Stripe)
|
||
- ID.not: `NEXT_PUBLIC_IDNOT_*` via `Auth` et composants de login
|
||
- Télémétrie/Intégrations: Hotjar, Docaposte, 4NK
|
||
- Back:
|
||
- ID.not: `IDNOT_*` (auth, user/office, annuaire)
|
||
- Stripe: `STRIPE_*` (routes `/subscriptions/*`, webhook)
|
||
- Réseau front: `APP_HOST` pour callbacks/URLs
|
||
- Nginx/Compose:
|
||
- Route HTTP publique et correspondances de ports/containers
|
||
|
||
### Recommandations
|
||
- Aligner `APP_HOST` (back) avec l’URL publique réelle du front (incluant basePath dans les redirections si nécessaire)
|
||
- Vérifier que `NEXT_PUBLIC_*` ne contiennent aucun secret
|
||
- Centraliser un `.env`/CI par environnement (local/dev/staging/prod) et lister explicitement les valeurs attendues
|