Skip to content

Commit

Permalink
one config file
Browse files Browse the repository at this point in the history
  • Loading branch information
riverscuomo committed Jul 12, 2024
1 parent db2ed45 commit e3bd342
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ jobs:
run: |
mkdir -p assets
echo '{
"SPOTIFY_CLIENT_ID": "$SPOTIFY_CLIENT_ID",
"SPOTIFY_CLIENT_SECRET": "$SPOTIFY_CLIENT_SECRET",
"SPOTIFY_REDIRECT_URI": "$SPOTIFY_REDIRECT_URI",
"SPOTIFY_SCOPE": "$SPOTIFY_SCOPE",
"BACKEND_URL": "$BACKEND_URL"
}' > assets/config_prod.json
cp assets/config_prod.json assets/config.json
"SPOTIFY_CLIENT_ID": "$SPOTIFY_CLIENT_ID",
"SPOTIFY_CLIENT_SECRET": "$SPOTIFY_CLIENT_SECRET",
"SPOTIFY_REDIRECT_URI": "$SPOTIFY_REDIRECT_URI",
"SPOTIFY_SCOPE": "$SPOTIFY_SCOPE",
"BACKEND_URL": "$BACKEND_URL"
}' > assets/config.json

- name: Build Spotkin web app
Expand Down
4 changes: 1 addition & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ void main() async {
}

Future<Map<String, dynamic>> loadConfig() async {
// load different config if in production mode
String configFileName = (isProduction || kReleaseMode ) ? 'assets/config_prod.json' : 'assets/config_dev.json';
String configString = await rootBundle.loadString(configFileName);
String configString = await rootBundle.loadString('assets/config.json');
return jsonDecode(configString);
}

Expand Down
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ flutter:
# the material Icons class.
uses-material-design: true

# To add assets to your application, add an assets section, like this:
assets:
- assets/config_dev.json
- assets/config.json
- assets/sample_jobs.json

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

0 comments on commit e3bd342

Please sign in to comment.