Skip to content

Commit 460addd

Browse files
committed
web deployment: last fix
1 parent 260234e commit 460addd

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

.github/workflows/deploy_web.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ jobs:
3030

3131
- name: Install dependencies
3232
run: flutter pub get
33-
34-
- name: create sample .env file
35-
run: touch .env
3633

3734
- name: Build web
3835
run: flutter build web --release --dart-define=SUPABASE_URL=${{ secrets.SUPABASE_URL }} --dart-define=SUPABASE_KEY=${{ secrets.SUPABASE_KEY }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ app.*.map.json
4545
/android/app/profile
4646
/android/app/release
4747
/dist/
48-
dotenv
48+
dotenv
49+
run.sh

lib/main.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,10 @@ Future<void> main() async {
1919
// Load environment variables
2020
if (kIsWeb) {
2121
// For web, use --dart-define values
22-
supabaseUrl =
23-
const String.fromEnvironment('SUPABASE_URL', defaultValue: '');
24-
supabaseApiKey =
25-
const String.fromEnvironment('SUPABASE_KEY', defaultValue: '');
26-
27-
if (supabaseUrl == '' && supabaseApiKey == '') {
28-
await dotenv.load(fileName: '.env');
29-
supabaseUrl = dotenv.env['SUPABASE_URL'] ?? '';
30-
supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? '';
31-
}
22+
supabaseUrl = const String.fromEnvironment('SUPABASE_URL', defaultValue: '');
23+
supabaseApiKey = const String.fromEnvironment('SUPABASE_KEY', defaultValue: '');
3224
} else {
33-
// For non-web (local dev), load from .env
25+
// For non-web platforms, load from .env
3426
await dotenv.load(fileName: '.env');
3527
supabaseUrl = dotenv.env['SUPABASE_URL'] ?? '';
3628
supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? '';
@@ -88,4 +80,4 @@ class _MyAppState extends State<MyApp> {
8880
home: const SplashScreen(),
8981
);
9082
}
91-
}
83+
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ flutter:
8585
# To add assets to your application, add an assets section, like this:
8686
assets:
8787
- assets/
88-
- .env
88+
# - .env
8989
# - images/a_dot_ham.jpeg
9090

9191
# An image asset can refer to one or more resolution-specific "variants", see

0 commit comments

Comments
 (0)