Skip to content

Commit

Permalink
Merge branch 'dev' into ui/add-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
PHPLukaas authored Mar 14, 2024
2 parents a66c106 + 0fe2bc6 commit 74d67a6
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
2 changes: 2 additions & 0 deletions frontend/app_student/.env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DEV_API_URL=
PROD_API_URL=
6 changes: 5 additions & 1 deletion frontend/app_student/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ app.*.map.json
/android/app/release

# FVM Version Cache
.fvm/
.fvm/

# Env file
/.env
/.env.local
7 changes: 7 additions & 0 deletions frontend/app_student/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ Avant de pousser votre code, assurez-vous de respecter les points suivants :
- Exécutez `flutter analyze` pour détecter tout problème dans votre code.
- Assurez-vous d'exécuter `pub get` pour installer toutes les dépendances du projet.

### Variables d'environnement

Pour que l'application fonctionne correctement, vous devez définir les variables d'environnement suivantes dans un fichier `.env` à la racine du projet :

- `API_URL_DEV`: URL de l'API de développement.
- `API_URL_PROD`: URL de l'API de production.

## Contributions

Les contributions des autres étudiants sont les bienvenues! N'hésitez pas à proposer des améliorations, des corrections de bugs ou de nouvelles fonctionnalités en soumettant des pull requests.
Expand Down
4 changes: 3 additions & 1 deletion frontend/app_student/lib/config/dev_config.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter_dotenv/flutter_dotenv.dart';

import 'config.dart';

class DevConfig extends Config {
@override
String get apiUrl => 'https://api-dev.lukasvalois.com';
String get apiUrl => dotenv.env['DEV_API_URL'] ?? 'http://localhost:8000';
}
4 changes: 3 additions & 1 deletion frontend/app_student/lib/config/prod_config.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter_dotenv/flutter_dotenv.dart';

import 'config.dart';

class ProdConfig extends Config {
@override
String get apiUrl => 'https://api.lukasvalois.com';
String get apiUrl => dotenv.env['PROD_API_URL'] ?? 'http://localhost:8000';
}
4 changes: 3 additions & 1 deletion frontend/app_student/lib/main_dev.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import 'package:app_student/config/dev_config.dart';
import 'package:app_student/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';

import 'config/config.dart';

void main() {
void main() async {
await dotenv.load();
runApp(
Provider<Config>(
create: (_) => DevConfig(),
Expand Down

0 comments on commit 74d67a6

Please sign in to comment.