Set up Dev and Prod enviroments and updae docker to build prod enviroment

This commit is contained in:
2024-07-11 15:17:34 +02:00
parent 8bf613801d
commit 1c7db86571
26 changed files with 79 additions and 17 deletions

View File

@@ -46,7 +46,7 @@ WORKDIR /app/
# RUN flutter pub add web:^0.5.0
# RUN flutter pub run pdfx:install_web
RUN flutter upgrade
RUN flutter build web
RUN flutter build web -t ./lib/main_prod.dart
# Record the exposed port
EXPOSE 8080

View File

@@ -0,0 +1,36 @@
enum Enviroment { dev, prod }
abstract class AppEnviroment {
static late String baseApiUrl;
static late Enviroment _enviroment;
static Enviroment get enviroment => _enviroment;
static setupEnv(Enviroment env) {
_enviroment = env;
switch (env) {
case Enviroment.dev:
{
baseApiUrl = "http://localhost";
break;
}
case Enviroment.prod:
{
baseApiUrl = "api";
break;
}
}
}
static String getEnv() {
//_enviroment = env;
switch (_enviroment) {
case Enviroment.dev:
{
return "Dev";
}
case Enviroment.prod:
{
return "Prod";
}
}
}
}

View File

@@ -1,22 +1,28 @@
import 'package:flutter/material.dart';
import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/router/routeGenerator.dart';
import 'package:patient_manager/theme/mihTheme.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Supabase.initialize(
url: "https://stzluvsyhbwtfbztarmu.supabase.co",
anonKey:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InN0emx1dnN5aGJ3dGZienRhcm11Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTIwNzUyMTMsImV4cCI6MjAyNzY1MTIxM30.a7VHlk63JJcAotvsqtoqiKwjNK4EbnNgKilAqt1iRio",
);
runApp(const MzanziInnovationHub());
}
// void main() async {
// WidgetsFlutterBinding.ensureInitialized();
// await Supabase.initialize(
// url: "https://stzluvsyhbwtfbztarmu.supabase.co",
// anonKey:
// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InN0emx1dnN5aGJ3dGZienRhcm11Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTIwNzUyMTMsImV4cCI6MjAyNzY1MTIxM30.a7VHlk63JJcAotvsqtoqiKwjNK4EbnNgKilAqt1iRio",
// );
// runApp(const MzanziInnovationHub());
// }
final client = Supabase.instance.client;
class MzanziInnovationHub extends StatefulWidget {
const MzanziInnovationHub({super.key});
//final AppEnviroment appEnv;
const MzanziInnovationHub({
super.key,
//required this.appEnv,
});
@override
State<MzanziInnovationHub> createState() => _MzanziInnovationHubState();
@@ -62,7 +68,7 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Mzansi Innovation Hub',
title: 'Mzansi Innovation Hub - ${AppEnviroment.getEnv()}',
themeMode: _themeMode,
theme: theme.darkMode(),
darkTheme: theme.lightMode(),

View File

@@ -1,14 +1,16 @@
import 'package:flutter/material.dart';
import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/main.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
void main() async {
AppEnviroment.setupEnv(Enviroment.dev);
WidgetsFlutterBinding.ensureInitialized();
await Supabase.initialize(
url: "https://stzluvsyhbwtfbztarmu.supabase.co",
anonKey:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InN0emx1dnN5aGJ3dGZienRhcm11Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTIwNzUyMTMsImV4cCI6MjAyNzY1MTIxM30.a7VHlk63JJcAotvsqtoqiKwjNK4EbnNgKilAqt1iRio",
);
print(String.fromEnvironment('baseURL'));
//print(AppEnviroment.baseApiUrl);
runApp(const MzanziInnovationHub());
}

View File

@@ -0,0 +1,16 @@
import 'package:flutter/material.dart';
import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/main.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
void main() async {
AppEnviroment.setupEnv(Enviroment.prod);
WidgetsFlutterBinding.ensureInitialized();
await Supabase.initialize(
url: "https://stzluvsyhbwtfbztarmu.supabase.co",
anonKey:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InN0emx1dnN5aGJ3dGZienRhcm11Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTIwNzUyMTMsImV4cCI6MjAyNzY1MTIxM30.a7VHlk63JJcAotvsqtoqiKwjNK4EbnNgKilAqt1iRio",
);
//print(AppEnviroment.baseApiUrl);
runApp(const MzanziInnovationHub());
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
database/binlog.000059 Normal file

Binary file not shown.

View File

@@ -1,6 +1,5 @@
4294967294,448
4294967278,398
4294967278,397
4294967294,449
4294967278,389
4294967293,131
4294967293,130
4294967293,129
@@ -267,9 +266,9 @@
4294967278,280
4294967278,413
4294967278,6
4294967278,398
4294967278,258
4294967278,5
4294967278,389
4294967278,257
4294967278,4
4294967278,3
@@ -295,3 +294,6 @@
4294967279,442
4294967279,126
4294967279,441
4294967279,256
4294967279,125
4294967279,440

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.