Skip to content

Commit

Permalink
feature: allowing FLUTTER_GIT_URL to be the default value of flutterUrl
Browse files Browse the repository at this point in the history
The Flutter project reports a warning to users who replace the standard GitHub location of Flutter with their own. They also provide an environment variable (`FLUTTER_GIT_URL`) which can be set by the user to indicate that this is intentional.

FVM provides a similar feature to override the GIT location from which the Flutter install will be cloned, and it is implemented as the command-line parameter `--flutterUrl`.

Defaulting to using the environment variable defined by Flutter as the value of `flutterUrl`, provides most corporations that host their own repository with a seamless use of the `fvm` tool without requiring all developers to include the `--flutterUrl` parameter manually.
  • Loading branch information
oravecz-jpmc committed Jan 25, 2024
1 parent 5ce894d commit 742dca6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/src/services/config_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:fvm/src/utils/helpers.dart';

import '../../fvm.dart';

const String flutterGitUrl = 'FLUTTER_GIT_URL';

/// Service to manage FVM Config
class ConfigRepository {
const ConfigRepository._();
Expand Down Expand Up @@ -48,6 +50,11 @@ class ConfigRepository {
String? cachePath;
bool? priviledgedAccess;

// Default to Flutter's environment variable if present; can still be overridden
if (environments.containsKey(flutterGitUrl)) {
flutterUrl = environments[flutterGitUrl];
}

for (final variable in ConfigKeys.values) {
final value = environments[variable.envKey];
final legacyFvmHome = environments['FVM_HOME'];
Expand Down

0 comments on commit 742dca6

Please sign in to comment.