forked from yaso_meth/mih-project
Set up Dev and Prod enviroments and updae docker to build prod enviroment
This commit is contained in:
@@ -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
|
||||
|
||||
36
Frontend/patient_manager/lib/env/env.dart
vendored
Normal file
36
Frontend/patient_manager/lib/env/env.dart
vendored
Normal 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";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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(),
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
16
Frontend/patient_manager/lib/main_prod.dart
Normal file
16
Frontend/patient_manager/lib/main_prod.dart
Normal 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());
|
||||
}
|
||||
Reference in New Issue
Block a user