Skip to content

Commit

Permalink
chore: use kReleaseMode to set prod config
Browse files Browse the repository at this point in the history
  • Loading branch information
borgoat committed Nov 11, 2024
1 parent 073b85d commit 3640504
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 15 deletions.
5 changes: 5 additions & 0 deletions assets/env/local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"supabaseConfigPath": "supabase/config/localhost.json",
"socialAuthWebClientId": "655087059227-32trs4upje1r6itvs3p1c1fs0m98m8ol.apps.googleusercontent.com",
"socialAuthIosClientId": "655087059227-o10vdnfsvnkl9ct8isg8db3j74s0rfur.apps.googleusercontent.com"
}
5 changes: 5 additions & 0 deletions assets/env/supabase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"supabaseConfigPath": "supabase/config/supabase.json",
"socialAuthWebClientId": "655087059227-32trs4upje1r6itvs3p1c1fs0m98m8ol.apps.googleusercontent.com",
"socialAuthIosClientId": "655087059227-o10vdnfsvnkl9ct8isg8db3j74s0rfur.apps.googleusercontent.com"
}
5 changes: 0 additions & 5 deletions env/dev.json

This file was deleted.

5 changes: 0 additions & 5 deletions env/local.json

This file was deleted.

2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 569636ff5edb32636892b1c748f656de700236ae

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
1 change: 1 addition & 0 deletions lib/presentation/screens/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AuthScreen extends StatelessWidget {
onSuccess(session) => HomeScreenRoute().go(context);

final config = ConfigService().config;

return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.appName),
Expand Down
8 changes: 5 additions & 3 deletions lib/util/config.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert';

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:freezed_annotation/freezed_annotation.dart';

part 'config.freezed.dart';
part 'config.g.dart';
Expand All @@ -16,8 +18,8 @@ class ConfigService {
}

Future<void> initialize() async {
const env = String.fromEnvironment('ENV', defaultValue: 'local');
final envConfigFile = await rootBundle.loadString('env/$env.json');
const env = kReleaseMode ? 'supabase' : 'local';
final envConfigFile = await rootBundle.loadString('assets/env/$env.json');
final config =
Config.fromJson(json.decode(envConfigFile) as Map<String, dynamic>);
this.config = config;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ flutter:
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
- env/
- assets/env/
- supabase/config/

# An image asset can refer to one or more resolution-specific "variants", see
Expand Down
File renamed without changes.

0 comments on commit 3640504

Please sign in to comment.