Index: app/bin/tools_common.dart |
diff --git a/app/bin/tools_common.dart b/app/bin/tools_common.dart |
index 50d5d81bb8adde651a247ec701bb2851849d6f37..d3e7bfdbe8ff08390dcf18d259666622ad40b9cb 100644 |
--- a/app/bin/tools_common.dart |
+++ b/app/bin/tools_common.dart |
@@ -6,6 +6,7 @@ import 'dart:io'; |
import 'dart:async'; |
import 'package:appengine/appengine.dart'; |
+import 'package:gcloud/db.dart'; |
import 'package:gcloud/service_scope.dart'; |
import 'package:pub_dartlang_org/upload_signer_service.dart'; |
@@ -13,27 +14,16 @@ import 'server_common.dart'; |
import 'configuration.dart'; |
Future withProdServices(Future fun()) { |
- if (Platform.isMacOS) { |
- return _withProdServices(() { |
- return fork(() async { |
- await initializeApiaryDatastore(); |
- return fun(); |
- }); |
+ return withCorrectDatastore((_) { |
+ if (!Platform.environment.containsKey('GCLOUD_PROJECT') || |
+ !Platform.environment.containsKey('GCLOUD_KEY')) { |
+ throw 'Missing GCLOUD_* environments for package:appengine'; |
+ } |
+ return withAppEngineServices(() { |
+ registerUploadSigner( |
+ new ServiceAccountBasedUploadSigner(activeConfiguration.credentials)); |
+ initBackend(); |
+ return fun(); |
}); |
- } else { |
- return _withProdServices(fun); |
- } |
-} |
- |
-Future _withProdServices(Future fun()) async { |
- if (!Platform.environment.containsKey('GCLOUD_PROJECT') || |
- !Platform.environment.containsKey('GCLOUD_KEY')) { |
- throw 'Missing GCLOUD_* environments for package:appengine'; |
- } |
- return withAppEngineServices(() { |
- registerUploadSigner( |
- new ServiceAccountBasedUploadSigner(activeConfiguration.credentials)); |
- initBackend(); |
- return fun(); |
- }); |
+ }, null); |
} |