merge(develop): clôture ticket #28 et stabilisation build/prod
Intègre en un seul commit master les changements de develop : templates email de validation (#28), alignement schéma validations + patches SQL, montée Flutter 3.29 (CI/Docker), correctifs bootstrap web/nginx/API origin et gestion HTTP 201 sur validation dossier famille. Made-with: Cursor
This commit is contained in:
@@ -1,14 +1,24 @@
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
|
||||
class Env {
|
||||
// Base URL de l'API, surchargeable à la compilation via --dart-define=API_BASE_URL
|
||||
static const String apiBaseUrl = String.fromEnvironment(
|
||||
'API_BASE_URL',
|
||||
defaultValue: 'https://app.ptits-pas.fr',
|
||||
);
|
||||
/// Base URL de l’API (sans `/api/v1`).
|
||||
///
|
||||
/// - **Web prod** : par défaut on utilise [Uri.base.origin] (même schéma + hôte que la page),
|
||||
/// ce qui évite les blocages « mixed content » (ex. page en `http://` vs API en `https://`)
|
||||
/// et les builds où `--dart-define=API_BASE_URL` ne serait pas passé.
|
||||
/// - **Web dev** : surcharger avec `--dart-define=API_BASE_URL=http://localhost:3000` (ou l’URL du back).
|
||||
/// - **Mobile** : défaut `https://app.ptits-pas.fr` ou `API_BASE_URL` en `--dart-define`.
|
||||
static String get apiBaseUrl {
|
||||
const fromEnv = String.fromEnvironment('API_BASE_URL');
|
||||
if (fromEnv.isNotEmpty) {
|
||||
return fromEnv;
|
||||
}
|
||||
if (kIsWeb) {
|
||||
return Uri.base.origin;
|
||||
}
|
||||
return 'https://app.ptits-pas.fr';
|
||||
}
|
||||
|
||||
// Construit une URL vers l'API v1 à partir d'un chemin (commençant par '/')
|
||||
static String apiV1(String path) => '$apiBaseUrl/api/v1$path';
|
||||
/// Construit une URL vers l'API v1 à partir d'un chemin (commençant par '/')
|
||||
static String apiV1(String path) => '${apiBaseUrl}/api/v1$path';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user